简体   繁体   English

Tomcat PermGen Space上的Spring MVC不断增加

[英]Spring MVC on Tomcat PermGen Space increase constantly

I have a web app built on top of SpringMVC 3.2 and running on Tomcat. 我有一个基于SpringMVC 3.2构建并在Tomcat上运行的Web应用程序。 I use the VisualVM to monitor the permgen space and found it increase constantly: 我使用VisualVM监视permgen空间,发现它不断增加: 在此处输入图片说明

I take three heap dump and run the "ClassLoader Loaded Classes Histo" analysis and found these results: 我进行了三个堆转储,然后运行“ ClassLoader Loaded Classes Histo”分析,发现以下结果:

the 9:44pm dump: 9:44 pm转储:

loader:org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader#1,
count:3285

the 9:55pm dump: 9:55 pm转储:

loader:org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader#1,
count:3286

the 7:40am dump: 上午7:40的转储:

loader:org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader#1,
count:3855

My app is very quite during the period. 在此期间,我的应用程序非常正常。 However it looks the number of classes been loaded are increasing constantly. 但是,看起来加载的类的数量正在不断增加。 I want to understand which classes are newly loaded across these heap dump. 我想了解在这些堆转储中新装入了哪些类。 Running the "ClassLoader Loaded Classes" doesn't give me too much information as I am buried into these kind of information: 运行“ ClassLoader加载的类”并不会给我太多信息,因为我被这些信息所掩盖: 在此处输入图片说明

Anyone has experience on analysing this kind of issue? 任何人都有分析此类问题的经验?

Update with the JVM info 使用JVM信息更新

JVM: Java HotSpot(TM) 64-Bit Server VM (20.45-b01, mixed mode)
Java: version 1.6.0_45, vendor Sun Microsystems Inc.

JVM args: JVM参数:

-Dvisualvm.id=4226015013703
-Xdebug
-Xrunjdwp:transport=dt_shmem,address=javadebug,suspend=y,server=n
-Dvisualvm.id=4214057282541
-Denv=dev-no-mas
-Dorg.slf4j.simpleLogger.defaultLogLevel=debug
-Dssgateway.disabled=true
-Dcom.sun.management.jmxremote=
-Dcom.sun.management.jmxremote.port=1299
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=127.0.0.1
-Djava.util.logging.config.file=C:\Users\luog.IKARI\.IntelliJIdea13\system\tomcat\Unnamed_rythm_2\conf\logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=C:\l\j\apache-tomcat-6.0.29\endorsed
-Dcatalina.base=C:\Users\luog.IKARI\.IntelliJIdea13\system\tomcat\Unnamed_rythm_2
-Dcatalina.home=C:\l\j\apache-tomcat-6.0.29
-Djava.io.tmpdir=C:\l\j\apache-tomcat-6.0.29\temp
  • PermGen is basically heap that should hold the system object, The Heap for the application object is the regular heap space.. PermGen基本上是应该容纳系统对象的堆,应用程序对象的堆是常规堆空间。

The general issue is that every class hold reference to the Class definition and every class loader that created him, And every classloader hold a reference to all the classes he is created. 普遍的问题是,每个类都包含对Class定义的引用以及创建该类定义的每个类加载器,并且每个类加载器均包含对他创建的所有类的引用。 So when the garbage collector moving on all the objects, because they have always reference they keep growing.. and the GC not release them. 因此,当垃圾收集器在所有对象上移动时,由于它们始终具有引用关系,因此它们会不断增长..而GC不会释放它们。 In the example they use : 在示例中,他们使用:

${JAVA_HOME}/bin/jvisualvm $ {JAVA_HOME} / bin中/ jvisualvm

Which is tool that can help you, The Solution is long and the link provide help with images.. This tool can help you find the classloader that cause the leak(Class loader is for every application under the server in order to ley several applications run toghther under the same server) 这是可以为您提供帮助的工具,“解决方案”很长,并且链接提供了有关图像的帮助。.此工具可以帮助您找到导致泄漏的类加载器(类加载器适用于服务器下的每个应用程序,以消除多个应用程序的运行情况在同一台服务器下)

Than you will go find the problem class.. Once you will know what is causing the problem you will be able to cure it.. 比您将查找问题类别。.一旦您知道是什么原因导致了问题,您就可以解决它。

This is link that will exaplain why this is happening and how to deal: 此链接将说明发生这种情况的原因以及如何处理:

cdivilly.wordpress.com/2012/04/23/permgen-memory-leak/ cdivilly.wordpress.com/2012/04/23/permgen-memory-leak/

You can read this great presentation .. From page 11 you can see how you can identify the leaks and the solutions.. Very Very useful http://people.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf 您可以阅读这份精彩的演讲。.从第11页开始,您将看到如何识别泄漏和解决方法。.非常非常有用的http://people.apache.org/~markt/presentations/2010-11-04-Memory -leaks-60mins.pdf

Hope that more helpful 希望对您有所帮助

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

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