Centos RES内存不断增加并越过java的初始和最大内存

时间:2013-04-03 19:41:34

标签: java linux garbage-collection

我们在Centos 6.4上运行了一个java应用程序,我们注意到RES大约是378m,这比分配的最大值256m要多。这是否意味着我们的应用程序正在泄漏?到目前为止还没有GC发生但很多YGC?这表明了什么?

下面是我的jstat结果以及MAT结果。

Timestamp         S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT   
      2331438.3  56.95   0.00  62.79  82.79  80.37   1362   54.337     0    0.000   54.337
      2331443.3  56.95   0.00  62.79  82.79  80.37   1362   54.337     0    0.000   54.337
      2331448.4  56.95   0.00  62.79  82.79  80.37   1362   54.337     0    0.000   54.337
      2331453.4  56.95   0.00  62.79  82.79  80.37   1362   54.337     0    0.000   54.337
      2331458.4  56.95   0.00  62.79  82.79  80.37   1362   54.337     0    0.000   54.337
      2331463.4  56.95   0.00  62.79  82.79  80.37   1362   54.337     0    0.000   54.337
      2331468.4  56.95   0.00  62.79  82.79  80.37   1362   54.337     0    0.000   54.337
      2331473.4  56.95   0.00  63.24  82.79  80.37   1362   54.337     0    0.000   54.337
      2331478.4  56.95   0.00  63.24  82.79  80.37   1362   54.337     0    0.000   54.337
      2331483.4  56.95   0.00  63.78  82.79  80.37   1362   54.337     0    0.000   54.337
      2331488.4  56.95   0.00  63.78  82.79  80.37   1362   54.337     0    0.000   54.337
      2331493.4  56.95   0.00  63.79  82.79  80.37   1362   54.337     0    0.000   54.337
      2331498.4  56.95   0.00  63.79  82.79  80.37   1362   54.337     0    0.000   54.337
      2331503.4  56.95   0.00  63.79  82.79  80.37   1362   54.337     0    0.000   54.337

MAT结果

java.lang.ref.Finalizer @ 0xf5e19670 40 92,688 
next java.lang.ref.Finalizer @ 0xf5e1a6a8 40 93,024 
next java.lang.ref.Finalizer @ 0xf5e1bda0 40 122,768 


Suspect 1.

The class "java.lang.ref.Finalizer", loaded by "<system class loader>", occupies 1,337,176 (30.93%) bytes. The memory is accumulated in one instance of "java.lang.ref.Finalizer" loaded by "<system class loader>".

Keywords
java.lang.ref.Finalizer


Suspect 2
 6 instances of "com.mysql.jdbc.JDBC4Connection", loaded by "sun.misc.Launcher$ExtClassLoader @ 0xf58bf000" occupy 432,624 (10.01%) bytes. 

Biggest instances:

•com.mysql.jdbc.JDBC4Connection @ 0xf61c54f8 - 94,864 (2.19%) bytes. 
•com.mysql.jdbc.JDBC4Connection @ 0xf61c4678 - 86,600 (2.00%) bytes. 
•com.mysql.jdbc.JDBC4Connection @ 0xf61c4bf8 - 85,456 (1.98%) bytes. 
•com.mysql.jdbc.JDBC4Connection @ 0xf626c348 - 68,000 (1.57%) bytes. 
•com.mysql.jdbc.JDBC4Connection @ 0xf626c7d0 - 68,000 (1.57%) bytes. 


Keywords
com.mysql.jdbc.JDBC4Connection
sun.misc.Launcher$ExtClassLoader @ 0xf58bf000

1 个答案:

答案 0 :(得分:1)

-Xmx仅限制JVM的堆内存空间 除了堆空间,JVM还为

分配内存
  • 默认情况下,Perm空间(类元数据)最高为64 MiB
  • 线程堆栈(每个线程256k,可配置)
  • 应用程序
  • 显式分配的I / O缓冲区和堆外缓冲区