Navigation Menu

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

should mheap.c throw when out of memory? #7871

Closed
robpike opened this issue Apr 26, 2014 · 2 comments
Closed

should mheap.c throw when out of memory? #7871

robpike opened this issue Apr 26, 2014 · 2 comments

Comments

@robpike
Copy link
Contributor

robpike commented Apr 26, 2014

It does a runtime.printf and returns false, causing later failures. Should it panic
instead, as most other OOM conditions do, for those sysiphean programmers who want to
try to recover?
@ianlancetaylor
Copy link
Contributor

Comment 1:

Note that most out-of-memory conditions call runtime·throw, which can not be recovered.
Right now if MHeap_Grow runs out of memory, it will eventually call runtime·throw in
largealloc or in runtime·MCache_Refill.

@dvyukov
Copy link
Member

dvyukov commented Apr 27, 2014

Comment 2:

It's not possible to recover from OOM in Go programs. What if OOM happens in the middle
of GC while allocating some metadata? Or in scheduler during allocation of a new thread
which is intended to prevent deadlock due to lack of worker threads?
All OOM conditions throw and terminate program.

Status changed to Unfortunate.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants