Go pprof: Got Error unrecognized profile format

7.2k views Asked by At

I'm developing a web program with Go revel framework(my go version is 1.6.2). And I got issues with the memory usage. The memory occupied by revel is increasing almost hundreds of MB every day. So I want to tune the program. Then I learn to use the go pprof and use the revel pprof as said in github.com/revel/modules/tree/master/pprof. But while I'm trying to get the memory profile with following command

go tool pprof http://sit:9000/debug/pprof/heap.

It got error unrecognized profile format. You can see as following snapshot.

enter image description here I've struggled on this issue for hours. Any help is appreciated! Thank you in advance!

1

There are 1 answers

1
ellimist On

It's most likely because your debug profile is empty. You need to specify how often to profile the app using SetBlockProfileRate

https://golang.org/pkg/runtime/#SetBlockProfileRate

Just import the runtime package in your main file and call the runtime.SetBlockProfileRate function.

Alternatively, you can use this package, which handles it for you, with some defaults: https://github.com/pkg/profile