Profiling a program using Golang's PPROF package

Source: Internet
Author: User

The program often appears oom error, and then the keyword "Go pprof" search the article <go program performance Analysis Pprof>, the article the second step of running the program will generate a profile file, but after the compilation run found that the generated profile file size has been 0, and then the keyword "Go pprof profile is empty" search article <golang pprof heap profile is empty>, the article said before running the program add environment variable godebug= "memprofilerate=1", But it doesn't seem to be useful.

Then or before the keyword "Go pprof" search article < use Golang Pprof package to perform performance analysis of the program, the article points out that "the use of Pprof in code, the actual use of three cases", because the program is not run once to exit, but as a service , so "need to open a goroutine to open port monitoring", and then refer to the article <go memory leak case> Note the description of the second step "(2) Memory profile" use--alloc_space to display all assigned objects ", When you use web commands, you get an error "Cannot find dot, you installed Graphviz?", and then the keyword "centos Graphviz" searched for the article <linux CENTOS7 installation configuration Drawing tool Graphviz> Graphviz but web commands will still error "Xdg-open:no method available for opening '/tmp/ Pprof-964683453/pprof001.svg ' ", do not know why I had to copy the temporary SVG file to Windows using IE, do not understand why the back curl-t to copy when said the file does not exist.

        If there is no ' import _  ' net/http/pprof "' in the program code, execute the go tool pprof   Http://localhost:6060/debug/pprof/heap "will error" Server response: 404 not found ". Keyword "Inuse_space" search article <golang Memory analysis/Dynamic tracking >
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.