为了在我们的 Tomcat tomcat-6.0.28 开发环境中跟踪永久空间 OOM,我们添加了 TraceClassloading、TraceClassUnloading 和 JMX 监控。服务器有三个 web 应用程序(devapp1、2、3),它们具有几乎相同的框架和库(Spring、Hibernate、Axis 等)。我希望每个应用程序的每个类都只加载一次,但是 traceclassloading 日志显示每个 webapp 加载两次相同的类。
示例(实际日志条目随着时间的推移而分散,为清楚起见将它们组合在一起)
[Loaded org.springframework.aop.framework.AdvisorChainFactory from file:/appl/devapp/tomcat/server/devapp/webapps/devapp3/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar]
[Loaded org.springframework.aop.framework.AdvisorChainFactory from file:/appl/devapp/tomcat/server/devapp/webapps/devapp3/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar]
[Loaded org.springframework.aop.framework.AdvisorChainFactory from file:/appl/devapp/tomcat/server/devapp/webapps/devapp2/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar]
[Loaded org.springframework.aop.framework.AdvisorChainFactory from file:/appl/devapp/tomcat/server/devapp/webapps/devapp2/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar]
[Loaded org.springframework.aop.framework.AdvisorChainFactory from
file:/appl/devapp/tomcat/server/devapp/webapps/devapp1/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar]
[Loaded org.springframework.aop.framework.AdvisorChainFactory from
file:/appl/devapp/tomcat/server/devapp/webapps/devapp1/WEB-INF/lib/spring-aop-3.0.6.RELEASE.jar]
但是,JVisualVM“总加载”计数似乎接近计算值(~18700),并且不显示重复。MaxPermSize 设置为 128M,现在在服务器运行一天后徘徊在 119M 左右。请让我知道什么可能导致 TraceClassLoading 和 JVisualVM 计数之间的这种差异,以及如何确认占用的 permgen 空间是否包含重复项?