[erlang-questions] eheap_alloc crash when using mnesia

Matthew Dempsky <>
Tue Oct 21 23:46:59 CEST 2008


On Tue, Oct 21, 2008 at 2:31 PM, Robert Raschke <> wrote:
> Apart from aborting your program, what would be a sensible thing to do
> when you run out of memory? Its not like you would actually be able to
> give some mem back to the system and continue. At least not in any
> system that I've come across.

Simple example: dnscache from djbdns.  Handling each new DNS query
requires allocating some temporary space for domain names that it
needs to resolve in the process.  If it fails to allocate memory for a
request at some point in the resolution process, it gives up on that
query, frees any memory it used, and continues handling other queries.
 This is a far better solution than crashing and dropping *every*
query *and* flushing the entire cache.

The same principle applies to any process handling multiple requests
simultaneously.



More information about the erlang-questions mailing list