Garbage collection of binaries

James Hague jamesh@REDACTED
Mon Oct 13 15:30:49 CEST 2003

If I write a tail recursive function that loads a large file as a
binary--say, 10MB--on each iteration, then the emulator quickly runs out of
memory and dies.  This is apparently because binaries are only garbage
collected when the regular garbage collector runs, and with large binaries
it's easy to run out of memory before then.  It's easy to get this to happen
in a real application.

One hacky solution is to call erlang:garbage_collect all over the place,
but...yuck.  Is this being addressed in the run-time system at some point?
Any other workarounds?

More information about the erlang-questions mailing list