我一直在寻找内存泄漏在我的应用程序和fhat与jhat由于某些原因枚举的实例保存在堆中。分析java heapdumps:为什么枚举实例保存在堆中?
为了模拟它,我在tomcat中部署了我的应用程序,使用了它,停止了它并在tomcat上执行GC(通过jconsole)。然后采取了堆转储,并发现这一点:
instance of [email protected] (16 bytes)
Class:
class x.mgbean.quote.Input$Tab
Instance data members:
name (L) : VEHICLE (24 bytes)
ordinal (I) : 0
References to this object:
[email protected] (24 bytes) : field value
class x.mgbean.quote.Input$Tab (84 bytes) : static field VEHICLE
[Lx.mgbean.quote.Input$Tab;@0xe0887f0 (20 bytes) : Element 0 of [Lx.mgbean.quote.Input$Tab;@0xe0887f0
[Lx.mgbean.quote.Input$Tab;@0xe1541e8 (20 bytes) : Element 0 of [Lx.mgbean.quote.Input$Tab;@0xe1541e8
任何想法如何发生这种情况?
好吧,我已经停止了web应用程序,没有必要让任何类仍然在堆中。所以我想知道为什么他们仍然是。 –
你解除了它,还是停下来?也许在应用程序解除部署之前,Tomcat不会使类加载器无法访问? –