Java Webapp: strange memory statistics
I'm running a Java web application(J2EE+Tomcat6+struts2+hibernate) on a Linux Centos machine. The problem is the "top" command says java is using 14% of memory(out of 8G) but in the summary information section, says the overall free memory is 300M! (just Mem, not swap)
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP TIME CODE DATA nFLT COMMAND
666 root 20 0 1352m 1.2g 10m S 7.6 14.7 663:00.37 158m 663:00 3开发者_开发技巧6 1.3g 65 java
3170 mysql 18 0 145m 33m 5044 S 0.7 0.4 753:51.96 111m 753:51 6496 132m 100 mysqld
17340 root 15 0 2332 1080 800 R 0.3 0.0 0:00.05 1252 0:00 56 468 0 top
1 root 15 0 2068 628 536 S 0.0 0.0 0:02.58 1440 0:02 32 280 20 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.18 0 0:00 0 0 0 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 0 0:00 0 0 0 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 0 0:00 0 0 0 watchdog/0
5 root RT -5 0 0 0 S 0.0 0.0 0:00.01 0 0:00 0 0 0 migration/1
6 root 34 19 0 0 0 S 0.0 0.0 0:00.00 0 0:00 0 0 0 ksoftirqd/1
7 root RT -5 0 0 0 S 0.0 0.0 0:00.00 0 0:00 0 0 0 watchdog/1
8 root RT -5 0 0 0 S 0.0 0.0 0:00.01 0 0:00 0 0 0 migration/2
.
.
.
and so on...
Mem: 8300688k total, 7998720k used, 301968k free, 52452k buffers
Swap: 16779884k total, 60k used, 16779824k free, 6511228k cached
what is the problem? what could be using memory covertly? non-heap or what?! thanks buddies.
6511228k cached
means ~6.5GB of RAM is used by your OS for caching.
If you're using Java 5+ you should be able to connect to the JVM using jconsole. There you should be able to see all the memory that the JVM uses. Unless there's a bug in the JVM implementation (which I would doubt), the numbers you see there is all this JVM uses.
If that's low enough, then some other process would use that memory.
精彩评论