Is there a Command-line Tool (Linux) to check Heap Size (and Used Memory) of a Java Application?
I have tried through jmap. But it gives info. about internal memory areas like Eden/ PermGen etc., which is not useful to me.
I am looking for something like:
That's all. I know that I can see this in JConsole etc., but I need a command-line tool (can't enable JMX etc.)
Do you know any such a tool/ command?
Each Java process has a pid
, which you first need to find with the jps
command.
Once you have the pid, you can use jstat -gc [insert-pid-here]
to find statistics of the behavior of the garbage collected heap.
jstat -gccapacity [insert-pid-here]
will present information about memory pool generation and space capabilities.
jstat -gcutil [insert-pid-here]
will present the utilization of each generation as a percentage of its capacity. Useful to get an at a glance view of usage.
See jstat docs on Oracle's site.