<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 3:39 PM, Nathaniel Waisbrot <span dir="ltr"><<a href="mailto:nathaniel@waisbrot.net" target="_blank">nathaniel@waisbrot.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">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.<br>
</blockquote></div><br></div><div class="gmail_extra">Yes, you can either set a default limit using "erl +hmax Limit", or in runtime using "erlang:system_flag(max_heap_size, Limit)".</div><div class="gmail_extra"><br></div><div class="gmail_extra">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.</div></div>