Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Linux by (18.4k points)

Do we have the Command-line Tool (Linux) to check the Heap Size (and Used Memory) of the Java Application?

I have tried through the jmap. But it gives info. about the internal memory areas like Eden/ PermGen etc., which is not useful to me.

This is what I am looking for:

  • Max Memory: 1GB
  • Min Memory: 256 MB
  • Heap Memory: 700 MB
  • Used Memory: 460 MB

That's all. I know that I can see this in the JConsole etc., but I need the command-line tool (can't enable JMX etc.)

Do you know any such tool/ command?

1 Answer

0 votes
by (36.8k points)

Each Java process has the pid, which you first need to find with a jps command.

Once you have a pid, you can use jstat -gc [insert-pid-here] to find statistics of this behavior of this garbage collected heap.

  • The jstat -gccapacity [insert-pid-here] will present information about memory pool generation and space capabilities.
  • The jstat -gcutil [insert-pid-here] will present the utilization of each generation as the percentage of its capacity. Useful to get an at glance view of usage.

Want to be a Linux expert? Come and join this linux course

 

Related questions

0 votes
1 answer
asked Dec 3, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...