GCJ and Boehm GC "Incremental Collection"

Craig A. Vanderborgh craigv@voxware.com
Tue Dec 6 17:36:00 GMT 2005

Hello Again,

Another idea has occurred to us, one that could reduce our need for 
"incremental GC" in the short run.

What we have been trying to do for several years now is to use certain 
memory heuristics to "anticipate" our application's need for GC, and 
then to request a GC ourselves as soon as possible before the collector 
would decide to do a "world-stopped" collection on its own.  This could 
allow us to perform GC at a "less disruptive" time, for example at a 
time that would not pause audio prompt playback in our application.

The trouble is that our attempts to come up with a predictive criterion 
for when GC will happen have all failed quite spectacularly.  The 
closest we've come is by using 
Runtime.freeMemory()/Runtime.totalMemory() to compute a "% Java memory 
available" and use a comparison to some constant to decide whether we 
should request GC.

Needless to say, this kind of thing does not really work.  So the 
question is - How can we find out whether Boehm GC is "thinking about" 
doing a collection before it actually decides to do one?  I'm going to 
go read the Boehm code and see what I can figure out, but any input from 
Dr. Boehm and others how to achieve this in an appropriate way would be 
greatly appreciated.

Thanks in advance,
craig vanderborgh
voxware incorporated

More information about the Java mailing list