Winster
Winster

Reputation: 1013

Major GC not running in G1

After analyzing the performance issues of an application, following points were noted.

I tried to collect more details about G1, but still a few questions left unanswered. Please help if you can.

  1. Is there minor, major or full GC if we use G1? If there is no such classification, why GC is not running for Old Gen? Documentation does not ascertain this.
  2. Even if GC not running for Old Gen, how does the memory free up even if it is a little? (for example, used memory decreases to 15GB from 16GB and again increases to 16GB)

Upvotes: 3

Views: 3072

Answers (2)

rcastellcastell
rcastellcastell

Reputation: 417

I have provided the documentation where it is explained that G1 uses something called mixed collections.

http://blog.sysco.no/files/guides/JVMGarbageCollectionV1.1.pdf

enter image description here

Upvotes: 0

rcastellcastell
rcastellcastell

Reputation: 417

Regarding your first question. The idea behind garbage collector implementations as G1 is to minimize and even to avoid the execution of full or major garbage collections since this is an stop the world event whose complexity generates longer pauses and consumption of CPU. Even when I am using the throughput GC, I am always trying to reduce the number of full garbage collections so I would say, it is really good that your system is running without executing full GCs.

What is more, keep in mind that if you are using a JDK lower than version 10, the execution of the Full GC with G1 is going to use just one thread as I pointed on this post.

Java 7 G1GC strange behaviour

By the way, it seems to be the newest version of Java (10) is going to include a G1 with the capability of executing Full GCs in parallel.

Regarding your second question. The memory is cleaned using the minor GC and this why you can see a reduction on the heap consumption.

On this document you can find a detailed explanation about G1.

http://blog.sysco.no/files/guides/JVMGarbageCollectionV1.1.pdf

The Dude

Upvotes: 1

Related Questions