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

Making Prompts for Profile Web Site

  Prompt: Can you create prompt to craft better draft in a given topic. Response: Sure! Could you please specify the topic for which you...