Friday, 14 April 2023

JVM Garbage Collection GC#003 (How)

 GC is a marvel of Java.

How to get GC Log so that we know what iss is happening , what is the foot print of execution phase image:

Let us explore the switches available for GC collection statistics in JVM 


GC Logging Flags in Java 8 and Earlier

 -XX:+PrintGC

-XX:+PrintGCDetails

 -XX:+PrintGCDateStamps and -XX:+PrintGCTimeStamps

-Xloggc


eg : java -cp $CLASSPATH -Xloggc mypackage.MainClass

                 or
   java -cp $CLASSPATH -Xloggc:/tmp/gc.log mypackage.MainClass 

GC Logging Flags in Java 9 and Later

eg: 

java -cp $CLASSPATH -Xlog:gc*=debug:file=/tmp/gc.log mypackage.MainClass

java -cp $CLASSPATH -Xlog:gc*=debug:stdout -Xlog:gc*=debug:file=/tmp/gc.log mypackage.MainClass






No comments:

Post a Comment

Angular 18 Navigation for iMMSS

  🚀 Setting Up Angular Routing - The Fun Way! 😆 Hey there, future Angular ninjas! 🥷 If you’re new to Angular and struggling with routing...