javamemory-leaksjvmnative-codejcmd

how to start Java NMT


I am trying to enable Native memory tracking in CMD with the below command.

  java -XX:NativeMemoryTracking=[off|summary|detail]

But getting an error like :

  'summary' is not recognized as an internal or external command,

operable program or batch file.

I also tried the below command:

  java -XX:NativeMemoryTracking=[off] and java -XX:NativeMemoryTracking= 
  [summary] and java -XX:NativeMemoryTracking=[detail]

But getting error like:

   Error occurred during initialization of VM
   Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]

Solution

  • [off|summary|detail] means one of, so you have to use it in the following way:

    java -XX:NativeMemoryTracking=off
    

    or

    java -XX:NativeMemoryTracking=summary
    

    or

    java -XX:NativeMemoryTracking=detail