Skip to content
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: memalloc does not respect cgroups limits (?) #22419

utrack opened this issue Oct 24, 2017 · 3 comments


None yet
4 participants
Copy link

commented Oct 24, 2017

What version of Go are you using (go version)?


Does this issue reproduce with the latest release?


What operating system and processor architecture are you using?


I'm trying to run a service that allocates lots of memory per request in Kubernetes pod w/ limited memory on a machine with lots of memory available - and service grows RES mem under load until it is killed due OOM. Service does not leak memory - running same binary with same load on a real machine with physical RAM of the same size yields stable RES mem graph.

It seems that memory allocator (or GC?) do not respect cgroups memory limits when deciding if GC should be ran aggressively and/or if unused res mem pages should be released.


This comment has been minimized.

Copy link

commented Oct 24, 2017

Dup of #5049? And this kind of issues are now tracked in #16843.


This comment has been minimized.

Copy link

commented Oct 24, 2017

@ALTree: yup, I saw those two. ulimit works independently of cgroups I believe, didn't check yet if cgroups are covered by #16843. Feel free to close the issue if it is.


This comment has been minimized.

Copy link

commented Oct 24, 2017

The current Go memory allocator does not respect any sort of memory limits at all. The current work on #16843 assumes that the user is going to explicitly tell the runtime package approximately how memory to allocate, with the understanding that the runtime may overshoot that number. Any attempt to set that limit automatically based on ulimit or whatever is going to be a later and longer discussion.

I don't think there is any purpose to be served by keeping this issue open at this time, so I am going to close it.

@golang golang locked and limited conversation to collaborators Oct 24, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.