I'm creating an NSIS script, where the Xmx value for the java application being installed can be set during the installation process. I'm not sure if this parameter is being set correctly. Is there a way to check the configured Xmx value when the application is running?
6 Answers
In my case, jmap is the best solution I could find:
jmap -heap <pid>
The above command shows full heap configuration + current usage.
The jmap command is included inside the jdk in the bin directory.
1 Comment
Cheap and dirty (not sure on reliability):
Runtime.getRuntime().maxMemory();
Have also used the following with success:
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
memoryBean.getHeapMemoryUsage().getMax();
1 Comment
jps is a good solution, just run
jps # shows pids
jps -v <pid> # shows params
remember to run it as the user that launched the process though, or it will not work properly.
2 Comments
I'm a big fan of kill -3 < pid > , which will give you details on the current memory and garbage collections along with stacks for all threads.
2 Comments
The following worked for me for JVM version 11.0.16 (I had installed OpenJDK 11)
sudo jhsdb jinfo --flags --pid <pid>
It may work for you without using "sudo".
I had to do this after sudo jhsdb jmap --heap --pid <pid> was giving me the following error message:
Exception in thread "main" sun.jvm.hotspot.types.WrongTypeException: No suitable match for type of address