On Mon, Sep 2, 2019 at 11:01 PM Chao Yuepan <smalln...@gmail.com> wrote: > > I have run a programas redis proxy which parses redis commands and redirects > to redis servers. > > I noticed it looks has memory leak issue. > > I use pprof to check the memory usage. It sows the total memory usage is > 856.02MB. I understand the value is memory usage in heap. > > > > > > If I check the runtime.memstats, it show the heapInUse is about 1.7GB. > > > > I use top to check RES of this program, it is 1.7G , it isthe same to > memstats.HeapInuse. > > > I'm surprised why the total value in pprof is very different from the real > memory usage? (856.02MB vs 1.7G) > > And How can I figure out those usage in heap which are not displayed in pprof?
HeapInUse tells you the amount of system memory allocated to hold Go objects, which includes space allocated to hold objects that do not yet exist or that have been released by the garbage collector. pprof tells you about live memory that is accessible by your program. With the default GOGC value of 100, in a program in steady state, it's normal for HeapInUse to be around twice as much as pprof memory, and that is what you are seeing. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcV5xO2QYBoQKk0RFeLKn7kquiu6G542QBPh%3DATqK-t7Ww%40mail.gmail.com.