On Mon, Sep 2, 2019 at 11:01 PM Chao Yuepan <
smal...@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