Skip to content

runtime: GC: heap idle is not released / decrease #14521

@tonglil

Description

@tonglil

This is my first time submitting to Go, apologies in advance if it is a non-helpful issue.

  1. What version of Go are you using (go version)?
    1.6
  2. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOHOSTARCH="amd64"
    GOHOSTOS="darwin"
    GOOS="darwin"
    CC="clang"
    GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
    CXX="clang++"
  3. What did you do?
    (Use play.golang.org to provide a runnable example, if possible.)

Sorry in advance, I am not able to extract a runnable example at the moment as it is a larger program I am debugging.

I am having issues with the GC in Go. Specifically, it does not seem to release idle heap memory back to the system, even after +10 minutes of inactivity (based on this) in the code/area that generated the initial garabage in the program.

Heap in use and allocated match one another (makes sense).
Heap sys = heap idle (this does not make sense to me).

  1. What did you expect to see?
    Heap idle to decrease.
  2. What did you see instead?
    Heap idle does not decrease over time. I even called runtime.GC() and then debug.FreeOSMemory() as well in attempt to release the memory.

Other information
Memory profile information from MemStats logged every 2 seconds:
picture1

I did reading of different sources and it one thought I see is that the GC may release memory, but it is up to the OS to collect/ask for it. Is this correct? Does this mean the memory footprint will not decrease without external intervention?

I thought maybe this problem has to do with #13552, however from 1.5 to 1.6 made no difference for me.

Thank you for your time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions