Controlling the garbage collector (GC) at RT?

David Daney ddaney@avtrex.com
Tue Feb 8 16:15:00 GMT 2005


Martin Egholm Nielsen wrote:
> And in relation to that thread, what is the effect of adjusting
> GC_free_space_divisor? (Maybe I should take that back in the old thread)
>
The GC sets up memory pools of different sized objects. If you have the 
divisor set too low in conjunction with a limited maximum heap size you 
can run into a situation where there are many of these pools that have 
some free space in them, but there is no memory left to expand the pool 
of a pool for a given size object. The result is an OutOfMemoryError 
even though the total space taken up by reachable objects is 
significantly smaller than the total available memory.
Increasing the value of the C_free_space_divisor (We use 20 - 30) causes 
the GC to run more often resulting in smaller pools for each size. The 
result being that the erroneous OOM is much less common (or in our case 
never happens).
>> Am I the only one that think a GCJ interface for controlling the GC
> would be neat?
>
I think it would be an excellent idea. I have code that does a heap 
dump that I would be good to put in the interface as well. Given the 
heap dump and a post processing program we generate things like the 
number and type of each reachable object as well as the value of each 
String. Many cool things are possible.
David Daney.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /