4

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!

trincot
  • 317,000
  • 35
  • 244
  • 286
Victor
  • 51
  • 1
  • 6

1 Answers1

1

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

ellimist
  • 586
  • 3
  • 12
  • Thanks for your reply. But as I use the revel framework, so the main function will be auto-generated. So I cannot add any codes in the main file. And I can user http://sit:9000/debug/pprof/heap?debug=1 to see the general information. I just cannot use the command to see deeper information. – Victor Dec 29 '16 at 01:58