How to get the current heap size of java on linux

W

wong_powah

How to get the current heap size of java on linux?

# java -version
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
Java HotSpot(TM) Server VM (build 1.6.0_02-b05, mixed mode)
 
J

Jason Cavett

How to get the current heap size of java on linux?

I could be wrong, but IIRC, passing the flag -verbosegc to the JRE
will output the current heap size whenever the garbage collector is
run. That's just off the top of my head, though...not sure if it's
true.
 
W

wong_powah

By using the java.lang.management APIhttp://java.sun.com/javase/6/docs/api/java/lang/management/package-
summary.html

By using an external JMX utility, ex. jconsolehttp://java.sun.com/javase/6/docs/technotes/guides/management/jconsol...

Good Luck.
--
Real Gagnon from Quebec, Canada
* Java, Javascript, VBScript and PowerBuilder code snippets
*http://www.rgagnon.com/howto.html
*http://www.rgagnon.com/bigindex.html

I am looking for a command line tool.
Is this the best way?
ps -ef|grep java
jmap -heap <pid>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top