Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
runtime/pprof: package emits invalid memory profile #6906
What steps will reproduce the problem? $ cat << EOF > simple.mprof heap profile: 10141899: 3497395080 [61368113: 46518687552] @ heap/1048576 6: 0 [12: 192] @ 0x42d56f 0x42e8c8 0x417e07 0x417fdd 0x601887 0x602f11 0x5140dc 0x51431c 0x51431c 0x514596 0x514ef5 0x510ccf 0x50b523 0x4c32ed 0x4ca90d 0x425b20 53: 0 [159: 2544] @ 0x42d56f 0x42e9d1 0x42ea5a 0x42a4ad 0x42a3e8 0x4e27cf 0x4e26bb 0x511722 0x512d4f 0x514d4d 0x5138bf 0x512b75 0x514d4d 0x510ccf 0x50b523 0x4c32ed 0x4ca90d 0x425b20 EOF $ go tool pprof /bin/sh simple.mprof (simple.mprof also available here ) What is the expected output? Although I simplified the mprof file, the two extracted lines are from real profile. Either the memory profiler is broken to generate this lines or the pprof is broken not to accept it. Or most likely both. The problem is with the second field. Pprof assumes that if first field is not zero, second must not be zero. This is not the case in mprofs generated in real world. What do you see instead? pprof crashes. It should not. Which version are you using? (run 'go version') $ hg id 87dea3f5ebe7+ (release-branch.go1.2) go1.2/release Please provide any additional information below. Here's a quick-and-dirty patch . Not sure if it's correct as I can't find any documentation of mprof file format.  https://gist.github.com/majek/fe71148abac09b7f867a/raw/34f4d1978b816e02557d2d3b26038da123ef34c9/simple.mprof  https://gist.github.com/majek/fe71148abac09b7f867a/raw/28fc6638e8e699ac0e87300eed3bfb4254384c2f/pprof.patch
I've tried to run std tests with the following patch and -memprofilerate=1024: https://golang.org/cl/62130043/diff/20001/src/pkg/runtime/mprof.goc but it did not catch anything. Maybe it will help you to localize the problem...