ParallelGC does not allocate all memory it could have

Emanuel Couto emanuel.amaral.couto at gmail.com
Tue May 8 17:32:04 PDT 2012


Hi,

I have a question regarding ParallelGC. I have used the following
parameters to execute a program that is creating objects of random
size until no more heap is available:

java -XX:+UseParallelGC -XX:+UseParallelOldGC -Xmx256m -jar <MyJar> <parameters>

I noticed that when it is not possible to allocate more memory in the
tenured generation and it is full, the JVM does not allocate the
maximum possible memory for the young generation, thus throwing an
OutOfMemoryException before the heap is full.

When the OutOfMemoryException is thrown the tenured generation
allocates 170MB, which is maximum size according to visualvm. The
young generation only allocates 20MB, but it had 85MB reserved.

This behavior does not happen with SerialGC or ConcurrentGC.

-- 
Emanuel Couto


More information about the hotspot-gc-use mailing list