Friday, 10 August 2018

jcmd: VM.flags: Print VM flag options and their current values

jcmd provides 'VM.flags' command, it print VM flag options and their current values.

HelloWorld.java
public class HelloWorld {
 public static void main(String args[]) throws Exception {
  Thread t1 = new Thread() {
   public void run() {
    while (true) {
     try {
      Thread.sleep(1000);
     } catch (Exception e) {

     }
    }
   }
  };

  t1.start();
 }
}


Compile HelloWorld.java



Execute HelloWorld.java by providing min and max heap size vm arguments.

java -Xms213m -Xmx1025m -classpath . HelloWorld

Open another command prompt and execute jcmd command.

C:\>jcmd
13220
14936 sun.tools.jcmd.JCmd
19784 HelloWorld

Execute the command 'jcmd 19784 help' to get the list of available commands associated with process id 19784.


As you see above image VM.flags command is available for the process id 19784.

Execute the command 'jcmd 19784 VM.flags' to print VM flag options and their current values.
C:\>jcmd 19784 VM.flags
19784:
-XX:CICompilerCount=3 -XX:InitialHeapSize=224395264 -XX:MaxHeapSize=1075838976 -XX:MaxNewSize=358612992 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=74448896 -XX:OldSize=149946368 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC


Previous                                                 Next                                                 Home

No comments:

Post a Comment