[erlang-questions] automatic garbage collection when low memo ry?

Convey Christian J NPRI ConveyCJ@REDACTED
Wed Mar 26 20:32:17 CET 2008


> > I've got a program that crashes unless I explicitly call 
> erlang:garbage_collect() at certain points.  I'm pretty sure 
> the problem is that I'm running out of memory simply because 
> the garbage collector isn't running often enough.
> 
> Do you use R11B or R12B?
> 
> Does your code use a lot of binaries or big integers?
> 
> R12B will do garbage collections more frequently when doing 
> calculations with big integers than R11B.

But more generally, why should Erlang crash when it gets low on memory?

Does the Erlang runtime not check for a malloc() or 'new' call returning NULL?  If so, that seems kind of crazy.

Or if the Erlang runtime *does* know when a memory allocation fails, wouldn't it make more sense for it to force garbage collection to occur and try again, rather than simply crashing?

- Christian



More information about the erlang-questions mailing list