Setting memory-chunk-size claimed when free-memory approaches zero?

David Daney ddaney@avtrex.com
Wed Nov 24 19:14:00 GMT 2004


Bryce McKinlay wrote:
>>
>>But neither happens - my application gets terminated by the Linux 
>>kernel...
>>
>>Now, the real question: Is there a way to circumvent this? Can I 
>>configure the chunk-eating-mechanism so that it does not allocate 
>>chunks larger than, say, 100kb at a time...
> 
> 
> 
> GCJ's garbage collector does not, by default, set a maximum heap size. 
> This means that it will keep requesting more memory from the system, if 
> required, until VM is exhausted. On Linux systems this might mean that 
> the kernel kills your application.
> 
> The way to avoid this is to set the maximum heap size to the maximum 
> amount of memory you want your application to use. You can do this by 
> setting the environment variable GC_MAXIMUM_HEAP_SIZE=<bytes>
> 
If you do set GC_MAXIMUM_HEAP_SIZE, then you should also probably set the
divisor to a larger value (I forget the exact name of the variable).  If
you use the default divisor value with a limited memory setting you can run
into situations where you get OutOfMemoryError which can be eliminated with
a larger divisor.  We use a divisor value of 20.

David Daney.



More information about the Java mailing list