FAQ
Hello,

I'm trying to figure out what looks like a strange memory allocation
problem in one of our applications.
It seems that for some reason which I can't determine the memory allocated
by gob.Encoder's internal byte slice is not being freed, or at least that's
what the profile seems to indicate.

Here's a link to a portion of the relevant pprof diagram with --inuse_space:

https://www.dropbox.com/s/0b1710zsqvkptr1/Screenshot%202014-09-29%2013.14.11.png?dl=0

The source of the original Encode() call is from Save() method from the
go-cache package:

https://github.com/pmylund/go-cache/blob/master/cache.go#L872

I confirmed that the method finished running and is not blocked, and the
invocation only happens once on startup of the application. At the point
this heap dump was taken it had already
been running for a number of days...

So my question is why does it seem like this memory is still in use?

This is with go1.3 on Linux/amd64

- K

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Kamil Kisiel at Sep 30, 2014 at 3:45 pm
    So after some further debugging it seems that after a call to
    FreeOSMemory() this part of the profile disappears.

    So my theory is that this span of memory was just not returned to the OS by
    the scavenger because parts of it were being reused by other allocations.
    I'm not 100% certain on the details of how the memory allocator and
    scavenger work, but based on my understanding the scavenger returns spans
    to the OS
    roughly every 5 minutes if they are completely unused. However parts of a
    span can be reused by the runtime for other allocations.

    That would explain this behaviour.

    Can anyone confirm my theory, or give another explanation?
    On Monday, September 29, 2014 1:57:39 PM UTC-7, Kamil Kisiel wrote:

    Hello,

    I'm trying to figure out what looks like a strange memory allocation
    problem in one of our applications.
    It seems that for some reason which I can't determine the memory allocated
    by gob.Encoder's internal byte slice is not being freed, or at least that's
    what the profile seems to indicate.

    Here's a link to a portion of the relevant pprof diagram with
    --inuse_space:


    https://www.dropbox.com/s/0b1710zsqvkptr1/Screenshot%202014-09-29%2013.14.11.png?dl=0

    The source of the original Encode() call is from Save() method from the
    go-cache package:

    https://github.com/pmylund/go-cache/blob/master/cache.go#L872

    I confirmed that the method finished running and is not blocked, and the
    invocation only happens once on startup of the application. At the point
    this heap dump was taken it had already
    been running for a number of days...

    So my question is why does it seem like this memory is still in use?

    This is with go1.3 on Linux/amd64

    - K
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 29, '14 at 8:57p
activeSep 30, '14 at 3:45p
posts2
users1
websitegolang.org

1 user in discussion

Kamil Kisiel: 2 posts

People

Translate

site design / logo © 2021 Grokbase