Getting GC Settings to Run JVM

Is there a way to get the GC settings to start the JVM?

I'm trying to figure out which GC algorithm works. SerialGC, ParallelGC, ParallelOldGC, ConcurrentMarkSweepGC, etc.

0
java garbage-collection
source share
2 answers

The JVM has a good MBean for this:

for(GarbageCollectorMXBean gc : ManagementFactory.getGarbageCollectorMXBeans()) { System.out.println(gc.getObjectName()); } 

You should see MBeans names such as "PS Scavenge" or "PS Mark Sweep". Use the following link to map names to algorithms:

Copy (Young) - Copy Collector

ParNew (Young) - Parallel collector of the young generation

PS Scavenge (Young) - Parallel garbage object

MarkSweepCompact (Old) - Mark and roll the seal

ConcurrentMarkSweep (Old) - Parallel Marking and Swing Seal

PS MarkSweep (old) - Parallel Tag and Arrow Collector

The same information can also be collected using any MBeans viewing toolkit: JConsole, JVisualVM, Jprofiler, etc.

+2
source share

You can use jconsole and access the JMX beans of your JVM in your GUI. There you can see GC details for Tenured or Young parts of the JVM Memory. It's just in your jdk / bin folder (HotSpot)

Here are some useful resources:

Using JConsole

+1
source share

All Articles