Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any command line tool for monitoring the heap size usage of Java in CentOS?

share|improve this question
up vote 3 down vote accepted

Use jps and jstack to learn more about Java processes. jstat can also be useful for Java statistics monitoring.

share|improve this answer

jvmtop is a command-line tool which provides a live-view at several metrics, including heap.

Example output of the VM overview mode:

 JvmTop 0.3 alpha (expect bugs)  amd64  8 cpus, Linux 2.6.32-27, load avg 0.12

 3370 rapperSimpleApp  165m  455m  109m  176m  0.12%  0.00% S6U37 web        21
11272 ver.resin.Resin [ERROR: Could not attach to VM]
27338 WatchdogManager   11m   28m   23m  130m  0.00%  0.00% S6U37 web        31
19187 m.jvmtop.JvmTop   20m 3544m   13m  130m  0.93%  0.47% S6U37 web        20
16733 artup.Bootstrap  159m  455m  166m  304m  0.12%  0.00% S6U37 web        46
share|improve this answer
why there is an error for process 11272? – akirekadu Apr 28 at 22:35
@akirekadu There are many reasons. The most common ones are incompatible JDKs between jvmtop and the target jvm or insufficient/denied permissions. See FAQ for details. – MRalwasser Apr 29 at 12:49

You probably want to analyse the memory usage.

GCView might help you visualize what the GC-log shows.

If you already enabled the gc-log you could just use tail -f on that log.

share|improve this answer
cd /opt/www/java/jdk/bin/

# jmap -heap <JAVA_PID>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.