[Gc] Why does GC_max_retries default to zero?

Kenneth C. Schalk ken at xorian.net
Fri Nov 5 10:20:12 PST 2004

An application I maintain which uses the garbage collector has been
getting steadily heavier use over time.  The incidence of failures
after the message "Out of Memory! Returning NIL!" has been increasing.
For some time I brushed these off as outside my control.  (When the OS
won't let you mmap any more pages, there's not a whole lot to do.)
However, I've just now been trying to figure out what we can do about
it (short of making the application use less memory, which could be
difficult or impossible).

I was surprised to find that when the collector decides to expand the
heap and fails, that the default behavior is to return 0 immediately,
rather than performing a collection.  This seems like a strange choice
to me, as I had expected that the collector would make a "last ditch"
collection in this case.

Obviously an application like mine can set GC_max_retries to a
different value, and I will probably do that, but 0 seems like a
strange default to me.

--Ken Schalk

More information about the Gc mailing list