简体   繁体   English

jvm的可用内存空间越来越小

[英]jvm free memory space is getting smaller

在此处输入图片说明

I use zabbix to monitor jvm's free memory space. 我使用zabbix监视jvm的可用内存空间。 His space is constantly decreasing. 他的空间在不断缩小。 What could be caused by this? 这可能是什么原因造成的? I suspect that it is a memory overflow. 我怀疑这是内存溢出。 Is there any way to check it out? 有什么办法可以检查出来吗? Can someone help me? 有人能帮我吗?

update 更新

After I restarted jvm, I executed the command jmap -histo:live . 重新启动jvm之后,我执行了命令jmap -histo:live Is there a problem with initialization here? 这里的初始化有问题吗?

num     #instances         #bytes  class name
----------------------------------------------
   1:        192100       28118472  [C
   2:         10757       10132704  [B
   3:        101676        8947488  java.lang.reflect.Method
   4:        165148        5284736  java.util.concurrent.ConcurrentHashMap$Node
   5:        187677        4504248  java.lang.String
   6:         19509        3519904  [I
   7:         62802        3014496  org.aspectj.weaver.reflect.ShadowMatchImpl
   8:         57683        2307320  java.util.LinkedHashMap$Entry
   9:         18410        2044672  java.lang.Class
  10:         40274        2016656  [Ljava.lang.Object;
  11:         62801        2009632  org.aspectj.weaver.patterns.ExposedState
  12:         59849        1915168  java.lang.ref.WeakReference
  13:          1342        1774328  [Ljava.util.concurrent.ConcurrentHashMap$Node;
  14:         22572        1753560  [Ljava.util.HashMap$Node;
  15:           920        1576512  [Ljava.nio.ByteBuffer;
  16:         47884        1532288  java.util.HashMap$Node
  17:         26167        1465352  java.util.LinkedHashMap
  18:         10874        1391872  org.aspectj.weaver.reflect.ReflectionBasedResolvedMemberImpl
  19:         49720        1085320  [Ljava.lang.Class;
  20:         45193        1084632  java.util.ArrayList
  21:         13421         966312  java.lang.reflect.Field
  22:         54885         878160  java.lang.Object
  23:         16797         806256  java.util.HashMap
  24:         19297         771880  java.lang.ref.SoftReference
  25:         23315         559560  java.beans.MethodRef
  26:         17695         530192  [Ljava.lang.String;
  27:          6508         520640  java.lang.reflect.Constructor
  28:          8305         465080  java.beans.MethodDescriptor
  29:         23607         459008  [Lorg.aspectj.weaver.ResolvedType;
  30:         17430         418320  org.springframework.core.MethodClassKey

This looks like a very normal memory usage graph for a Java application. 这看起来像是Java应用程序的非常正常的内存使用情况图。 As one of the comments points out, at 09:00 the JVM ran the garbage collector and that resulted in a lot of memory being freed. 正如其中一项评论所指出的那样,JVM在09:00运行了垃圾回收器,这导致释放了大量内存。 You don't provide the parameters you used to start your JVM so it's not clear what size your heap is (at a guess I would say 2Gb). 您没有提供用于启动JVM的参数,因此尚不清楚堆的大小(猜测我会说2Gb)。 Getting the free space back to 1.5Gb after a GC is fine. GC后将可用空间恢复到1.5Gb很好。 The subsequent slow decrease in free space afterwards is your application allocating objects to do whatever it needs to do. 随后,可用空间的缓慢减少是您的应用程序分配对象以执行其所需的任何操作。 My guess would also be that if you showed the graph of the application running for longer you would get another spike when the GC runs again. 我的猜测还在于,如果您显示应用程序的图形运行时间更长,则当GC再次运行时,还会出现另一个峰值。

So short answer is this is what the JVM is supposed to do. 简短的答案就是这是JVM应该做的。 If the application continues to run (ie, you don't get an OutOfMemoryError) then everything is fine. 如果应用程序继续运行(即您没有收到OutOfMemoryError),那么一切都很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM