FW: Garbage collection issues in GCJ

David Daney ddaney@caviumnetworks.com
Mon Jan 24 17:45:00 GMT 2011


On 01/22/2011 01:53 PM, Florian Weimer wrote:
> * Ben Keppler:
>
>> Thanks for your response.  We have been unable to find documentation
>> detailing how to change the GC configuration including knobs for setting
>> the max heap size.
>
> GCJ allocates as much memory as your application needs.  I think what
> David meant was that you should change your application to put less
> data into the Java heap (either by using the C heap, or by splitting
> it into multiple processes).
>

No, that is not what I meant at all.

At some point in any non-trivial program's execution, there will be a 
memory allocation request that cannot be met from the existing pools of 
free memory.  At this point the runtime memory allocator must make a 
decision.  Should it run a garbage collection cycle to try to free up 
some existing memory, or should it get more memory from the operating 
system.

My suggestion was to adjust the policy parameters such that it chooses 
the garbage collection option more often.  This results in a smaller 
total memory footprint, and thus faster garbage collection cycles.  The 
trade off is that you end up doing more garbage collection and less real 
work.  This may be acceptable though, if latency is important.

David Daney



More information about the Java mailing list