-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime: GC: heap idle is not released / decrease #14521
Comments
I also called FreeOsMemory(), nothing happends on linux, golang 1.5.3 10:17:52 WARN Allocated memory before GC: 3136 Mb |
Hmm, I am not sure but afaik runtime.GC() and debug.FreeOSMemory() are not guaranteed to release memory, since Go's GC is conservative, so it keeps memory, even if it is not in use, incase it has to allocate again. (Someone else correct me, if I am wrong. Just my observations) |
The go runtime can only advise the operating system that a section of The best way to determine the memory usage of your application is via On Fri, Feb 26, 2016 at 10:43 PM, Daniel Kaypour [email protected]
|
@Opposition, Go's GC is not conservative. It's a precise GC. |
HeapReleased is how much memory Go did give back to the OS. Go has no way of knowing if the OS did actually take the memory back, so it has no stat about that. HeapIdle includes the HeapReleased stat. So HeapIdle should not go down when Go gives the memory back to the OS. |
Problem is if linux will not take memory back, after some time process get On Fri, Feb 26, 2016 at 6:04 PM Keith Randall [email protected]
|
I'm not sure we can make progress on this without an example that we can run ourselves. |
If possible, you may want to try running your program under truss (or whatever it is called on Darwin) to confirm that the Go program is calling |
Thank you all for your help. I will run this on Linux and use truss or otherwise to see if I can get the OS to reclaim the memory and reduce the heap idle amount that way. Please feel free to close issue, I can update and reopen it at a later time with something more concrete for you to go on :)
|
This is my first time submitting to Go, apologies in advance if it is a non-helpful issue.
go version
)?1.6
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++"
(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).
Heap idle to decrease.
Heap idle does not decrease over time. I even called
runtime.GC()
and thendebug.FreeOSMemory()
as well in attempt to release the memory.Other information
Memory profile information from MemStats logged every 2 seconds:
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.
The text was updated successfully, but these errors were encountered: