0

I am going through jmap command documentation. -J options is documented like below.

-J<flag> : to pass <flag> directly to the runtime system

I am not getting, where exactly this scenario helps. For the experiment sake, I tried to increase the heap size of the running applicaiton using below command.

jmap -J-Xmx1024m <PROCESS_ID>

But there is no change in the heap size. I would like to know the use cases of jmap -J option. Please help me in understanding -J option.

Hari Krishna
  • 3,658
  • 1
  • 36
  • 57

1 Answers1

1

Unfortunately the runtime system the documentation is referring to is the Java process that the jmap command is running in - it too is written in Java.

-J works OK in jmap - e.g. one way to check this is to reduce the memory too far:

C:\>jmap -J-Xmx1m -histo <pid>
Error occurred during initialization of VM
Initial heap size set to a larger value than the maximum heap size

As for increasing the heap size of a running Java process, I'm not aware of any option to do this. This thread largely confirms this.

Most changes you can make to a running JVM would be from a JMX bean in JConsole, but not memory changes unfortunately.

df778899
  • 10,703
  • 1
  • 24
  • 36