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

RFC: Avoid running out of memory by checking available memory before allocating #46831

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Sep 19, 2022

This improves the user experience when running with a memory constraint, e.g. in a container, where malloc wouldn't fail but instead the OOM killer would terminate the process (which people have been frequently complaining about). #46796 improves the situation by using appropriate GC heuristics, but this PR would make it mostly impossible to overallocate.

RFC because:

  • too expensive: even though I assume these code paths are only executed for large allocations, adding ~10us is unacceptable
  • it's not waterproof, as allocations may come from external libraries
  • it makes it impossible to overcommit memory

…ating.

This improves the user experience when running with a memory constraint,
e.g. in a container, where malloc wouldn't fail but instead the OOM
killer would terminate the process.
Base automatically changed from tb/libuv to master September 20, 2022 07:05
@gbaraldi
Copy link
Member

Could we put this behind a command line flag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants