Spyros Lambrinidis [spy...@peopleperhour.com]:
> Then we increased the JVM memory to 4GB and we see that gradually, JVM
> starts to use as much as it can. It is now using 3GB out of the 4GB
> allocated.

That is to be expected. When the amount of garbage collections increases, the 
JVM might decide that it would be better overall to increase the size of the 
heap. Whether it will allocate up to your 4GB limit depends on how active it 
is. If you stress it, it will probably take the last GB. 

> i.e. Does the JVM always use as much as it can from the allocated space?

No, but the Oracle JVM do tend to be somewhat greedy (very subjective, I know). 
Since larger heaps means (hopefully infrequent) pauses for full garbage 
collection with a "standard" setup, the consensus seems to be that it is best 
to allocate conservatively and thereby avoid over-allocation. If 2GB worked 
well for you until you hit OOM, changing to 3GB seems like a better choice than 
4GB to me. Especially since you describe the allocation up to 3GB as gradual, 
which tells me that your installation is not starved with 3GB.

- Toke Eskildsen

Reply via email to