简体   繁体   English

tomcat:取消部署war文件不会卸载类

[英]tomcat: undeploying war file won't unload classes

I'm using : 我正在使用 :

  • tomcat 7.0.62 的tomcat 7.0.62
  • java 1.8.65 Java 1.8.65

    Suddenly i find my web application unresponsive, using jvisualVM just find out that the Metaspace acquired more than 3GB and loading 700K classes but my application only loads about 20K of classes. 突然我发现使用jvisualVM的Web应用程序没有响应,只是发现Metaspace获得了超过3GB的空间并加载了700K类,但是我的应用程序仅加载了约20K类。 I've been deploy/undeploy my application so many times in last few days and suspect that would be the reason of so many loaded classes. 在过去的几天中,我已经部署/取消部署应用程序很多次了,并且怀疑这可能是加载这么多类的原因。

Should'nt tomcat unload classes by undeploying applications, Normally or my app has a memory leak ? tomcat是否不应该通过取消部署应用程序来卸载类,通常还是我的应用程序存在内存泄漏?

PS: Reading catalina.log saw many logs about failed to stop some threads and it would be memmory leak, etc. PS:阅读catalina.log时会看到许多有关无法停止某些线程的日志,这可能是内存泄漏等。

The garbage collector can only collect what's not referenced any more. 垃圾收集器只能收集不再引用的内容。 If your application starts threads and doesn't stop them, there's your reference. 如果您的应用程序启动线程而不停止线程,那么您可以参考一下。

Figure out what threads don't get stopped and make corrections so that they are. 弄清楚哪些线程不会停止并进行更正,以使它们得以纠正。 That should fix your problem. 那应该解决您的问题。

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

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