简体   繁体   English

Apache Shiro 枚举仍在 Tomcat 上的 memory 中取消部署

[英]Apache Shiro Enums still in memory on Tomcat undeploy

When I undeploy a webapp that uses Apache Shiro, Tomcat Manager will detect leaks.当我取消部署使用 Apache Shiro 的 web 应用程序时,Tomcat Manager 将检测到泄漏。 I looked at the heap and searched for "org.apache.shiro.*" and I see that all of the Enums that Shiro uses, such as Cookie.SameSiteOptions, are still loaded in memory.我查看了堆并搜索了“org.apache.shiro.*”,我看到 Shiro 使用的所有枚举,例如 Cookie.SameSiteOptions,仍然加载在 memory 中。 Is there a way to prevent these from staying loaded in memory when I undeploy the webapp?当我取消部署 webapp 时,有没有办法防止这些在 memory 中保持加载? Would it cause a problem over time if I keep redeploying without restarting Tomcat?如果我在不重新启动 Tomcat 的情况下继续重新部署,随着时间的推移会导致问题吗?

Use a memory profiler to find the "GC roots" for the Shiro objects left around in memory.使用 memory 分析器查找 memory 中遗留的 Shiro 对象的“GC 根”。

You should always be able to trace an object back to a live object which is holding it in memory.您应该始终能够将 object 追溯到将其保存在 memory 中的实时 object。 You may find that the application's ClassLoader has been pinned in RAM due to some leak, and therefore everything loaded for your application will stick-around indefinitely.您可能会发现应用程序的ClassLoader由于某些泄漏而被固定在 RAM 中,因此为您的应用程序加载的所有内容都将无限期地保留。

Tracking-down these kinds of leaks is very important if you expect to be able to redeploy your application many times without restarting the JVM.如果您希望能够在不重新启动 JVM 的情况下多次重新部署应用程序,那么追踪此类泄漏非常重要。

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

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