JVM's Memory Usage

Hi, every one

I'm running jboss on Windows2003, and I'm trying to monitor the memory usage

of JVM. But, I encouter a problem:

when I use JMX, I got the following information:

- operating system -

arch : x86

avail processors : 4

os name : Windows 2003

os version : 5.2

- threads -

thread num : 111

daemon threads num : 92

peak threads num : 132

- memory -

objectPendingFinalizationCount : 0

heapMemoryUsage : init = 134217728(131072K) used = 168568176(164617K) committed = 532742144(520256K) max = 532742144(520256K)

nonHeapMemoryUsage : init = 8585216(8384K) used = 61972600(60520K) committed = 62455808(60992K) max = 100663296(98304K)

- class loader -

loadedClassCount : 8154

totalLoadedClassCount : 24471

unloadedClassCount : 16317

- memory pool -

[Tenured Gen: Used=151165K Committed=483968K]

[Perm Gen: Used=43802K Committed=44032K]

[Survivor Space: Used=0K Committed=4032K]

[Eden Space: Used=13979K Committed=32256K]

[Code Cache: Used=16723K Committed=16960K]

- garbage collector -

[Copy: Count=16410 GCTime=459.0070sec]

[MarkSweepCompact: Count=9773 GCTime=6689.2770sec]

But, in windows task manager, I got

java.exe 2136830,820K

and this increases slowly.

I just wonder why the os level memory usage is greater so much than

the heap memory and the non-heap memory, and the os level memory usage

are increasing slowly: three days before it is 620M, yesterday it is

720M and now it is 830M.

Sorry for my poor English

thanks

[1665 byte] By [jeffwang8001a] at [2007-10-3 4:55:39]
# 1

Hi,

As far as I understand there's a noticeable difference between the memory

managed by the JVM (which corresponds to what can be observed with

JConsole) and the memory of the JVM process itself (which is what can be

observed in Windows Task Manager).

see for instance this thread:

http://forum.java.sun.com/thread.jspa?threadID=598888&messageID=3351661

I am not a memory/windows expert, but maybe other members of this forum will

be able to provide more information...

Hope this helps,

-- daniel

JMX, SNMP, Java, etc...

http://blogs.sun.com/jmxetc

dfuchsa at 2007-7-14 23:00:50 > top of Java-index,Core,Monitoring & Management...
# 2

The total of heap memory usage and non-heap memory usage doesn't represent all native memory consumed by the process.

The non-heap memory includes the perm gen (for classes and method data) and code cache (for compiled code). Some internal data structures used by the VM are not counted.

The increasing use of the os native memory indicates a potential memory leak. What's the heap or non-heap memory usage after running for a few days? Are they increasing? If only the os native memory is increasing but not the heap/non-heap, the memory leak is likely in the native code.

What version of JDK are you using? You mention you use JMX, do you use java.lang.management.ThreadMXBean.getThreadInfo() method? There is a bug in 1.5 that is fixed in JDK 6:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434191

Mandy

mandy_kochunga at 2007-7-14 23:00:50 > top of Java-index,Core,Monitoring & Management...