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 >