Java Garbage Collection Strategy

I'm looking for a technique to find out the Garbage Collection (GC) strategy (collector) that Java VM is currently using. (Later, I would like him to correctly reflect the strategy that I chose, say XX:+UseConcMarkSweepGC.)

verbose:gc(in its basic form) does not help, because it just shows me that all this is with every generation. Is there any other flag that I can set to spit out the GC strategy used?

JDK Version - 1.6_21

+3
source share
4 answers

Mmmm.. , , , JVM jconsole ( VM Summary). , .

EDIT: JVM , jinfo.exe JDK. , , ParallelGC, : jinfo.exe -flag UseParallelGC <PID>.

+8

, JVM, GarbageCollectorMXBean

List<GarbageCollectorMXBean> gcs =
  ManagementFactory.getGarbageCollectorMXBeans();
for (GarbageCollectorMXBean gc : gcs) {
  System.out.println(gc.getName());
}
+4

Again, the behavior of the GC may influence, but is not predicted.

0
source

Source: https://habr.com/ru/post/1763562/


All Articles