julia icon indicating copy to clipboard operation
julia copied to clipboard

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

Open maleadt opened this issue 3 years ago • 1 comments

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). https://github.com/JuliaLang/julia/pull/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

maleadt avatar Sep 19 '22 14:09 maleadt

Could we put this behind a command line flag?

gbaraldi avatar Sep 20 '22 11:09 gbaraldi