Gur*_*ard 7 java tomcat memory-leaks jaxb
我已经追了好几天了.我们在我们的应用程序中使用JAXB,sun实现.当停止Tomcat(6或7)时,catalina日志文件中记录了严重的内存泄漏,列出了我们在应用程序中的所有JAXB类,两个不同的包中有两个类.
我经历过很多google和Stack溢出链接.我使用过JProfiler,它告诉我Tomcat在不使用时会持有Enums,但这不应该是问题.marshaller或unmarshaller的所有实例都是在本地创建的,并且对于激进的GC设置为null.我确保在销毁servlet时JAXBcontext为null,并且在我的contextDestroyed中运行System.gc(); 已被建议避免错误.
但仍然会记录错误.我在Tomcat演示文稿中看到这是已知的错误,因为JAXBContext.newInstance()创建了一个JarURLConnection锁,显然这可以通过禁用缓存来避免,但这对我没有任何作用. http://people.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf
关于如何在Tomcat上运行的JAXB中修复此内存泄漏的任何其他建议.
这是错误日志:
SEVERE: The web application [/myApplication] created a ThreadLocal with key of type [com.sun.xml.bind.v2.ClassFactory$1] (value [com.sun.xml.bind.v2.ClassFactory$1@6a724da1]) and a value of type [java.util.WeakHashMap] (value [{class my.package.model.layout.Element=java.lang.ref.WeakReference@7646bb9f, class my.package.model.layout.ScriptBeforeFileID=java.lang.ref.WeakReference@1dc80063, class my.package.model.layout.OutputProperty=java.lang.ref.WeakReference@359172db, class my.package.model.layout.Data=java.lang.ref.WeakReference@600ba356, class my.package.model.layout.InputProperty=java.lang.ref.WeakReference@1c10945d, class my.package.model.layout.ToPort=java.lang.ref.WeakReference@47c7410, class my.package.model.layout.ConfigFile=java.lang.ref.WeakReference@6a7c8bd, class my.package.model.layout.LayoutInstanceID=java.lang.ref.WeakReference@716bf3b4, class my.package.model.layout.ScriptAfterFunction=java.lang.ref.WeakReference@664ce898, class be.securit.trustbuilder.config.model.........}])
but failed to remove it when the web application was stopped.
Threads are going to be renewed over time to try and avoid a probable memory leak.
17-sep-2013 15:21:45 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
Run Code Online (Sandbox Code Playgroud)
Gur*_*ard 11
回顾完所有不同的帖子后,我注意到将JAXB lib放入Tomcat的共享库中.所以我从我的应用程序WEB-INF/lib中删除了jaxb-impl-xxxjar并将其放入[TomcatHome]/lib中.现在这一切都很可爱.不确定这是最好的,因为现在在Tomcat下安装时需要有不同的方法.
| 归档时间: |
|
| 查看次数: |
5290 次 |
| 最近记录: |