Upton
Upton

Reputation: 21

Why my java process used memory(Linux RES) keep increasing?

  1. I have a java(1.6 u25) process running on linux(centos 6.3 x64) with JAVA_OPTS="-server -Xms128M -Xmx256M -Xss256K -XX:PermSize=32M -XX:MaxPermSize=32M -XX:MaxDirectMemorySize=128M -XX:+UseAdaptiveSizePolicy -XX:MaxDirectMemorySize=128M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:GCTimeRatio=39 -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:gc.log", the java app used thrift 0.8.0 lib;

  2. run the TOP command everyday, the java process RES value will keep increasing(from 80MB to 1.2GB(after started the app one month)), but see the jvm heap size stay around 100 to 200MB, and see the GC log about 1~2 times PSyoungGC per minute, 1~2 times PSOld GC per day, no memory leak.

So, why the java process used mem will keep increasing and greatly exceeds the JVM settings? I think the java process really used mem will equals Xmx256M + MaxPermSize32M + MaxDirectMemorySize128M + JVM self used mem = about 416MB?

relation info : Virtual Memory Usage from Java under Linux, too much memory used

Upvotes: 2

Views: 3371

Answers (1)

Peter Lawrey
Peter Lawrey

Reputation: 533820

I suggest you look at pmap for the process. This will give a you a breakdown of native memory usage. Memory which you don't have so much control over are

  • The total stack space used by threads.
  • The size of memory mapped files
  • The size of shared libraries.
  • Native library memory usage. e.g Socket buffers (if you have enough sockets)

Some combination of these is using the difference.

Upvotes: 2

Related Questions