Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2008

Tip: Looking for answers? Try searching our database.

How to get the current heap size of java on linux

Thread view: 
wong_powah@yahoo.ca - 04 Jan 2008 17:15 GMT
How to get the current heap size of java on linux?
wong_powah@yahoo.ca - 04 Jan 2008 17:15 GMT
On Jan 4, 12:15 pm, wong_po...@yahoo.ca wrote:
> 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)
Real Gagnon - 04 Jan 2008 17:52 GMT
> On Jan 4, 12:15 pm, wong_po...@yahoo.ca wrote:
>> How to get the current heap size of java on linux?
[quoted text clipped - 3 lines]
> Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
> Java HotSpot(TM) Server VM (build 1.6.0_02-b05, mixed mode)

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

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

Good Luck.
Signature

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

wong_powah@yahoo.ca - 04 Jan 2008 18:49 GMT
> > On Jan 4, 12:15 pm, wong_po...@yahoo.ca wrote:
> >> How to get the current heap size of java on linux?
[quoted text clipped - 15 lines]
> *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>
Real Gagnon - 04 Jan 2008 19:03 GMT
>> By using the java.lang.management
>> APIhttp://java.sun.com/javase/6/docs/api/java/lang/management/package-
[quoted text clipped - 8 lines]
> ps -ef|grep java
> jmap -heap <pid>

Yep, jmap is the command line utility provided by the JDK1.6 for memory
related statistics.

http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/gbdid.html

Bye.
Signature

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

Jason Cavett - 04 Jan 2008 17:46 GMT
On Jan 4, 12:15 pm, wong_po...@yahoo.ca wrote:
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.