[erlang-questions] Max heap size
Wed Apr 27 16:06:12 CEST 2016
On Wed, Apr 27, 2016 at 3:39 PM, Nathaniel Waisbrot <nathaniel@REDACTED>
> Is there a way to globally set the spawn options? The typical case where
> I'd imagine using this is that I have an unforeseen bug in my code that
> exhausts memory and then the OOM-killer screws up the system and I don't
> get a clean trace of the error. So what I'd really like is to always set
> all of my processes to some max size (something close to the host's limit)
> without having to think about it.
Yes, you can either set a default limit using "erl +hmax Limit", or in
runtime using "erlang:system_flag(max_heap_size, Limit)".
However if it is a global maximum you want, then you might want to consider
to allocate a super carrier and then disallow any other memory creation.
i.e. "erl +MMsco true +Musac false +MMscs 256". This will limit the data
that the emulator will allocate to 256 MB, when reached a crash dump will
be created. If you want to protect yourself further from the OOM killer you
may also want to use +MMscrpm true, but that will make the memory Erlang
uses unavailable to other processes on the system while Erlang is running.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions