Ste*_*ote 1 java enums heap-memory heap-dump
我一直在寻找我的应用程序中的内存泄漏和fhat与jhat,由于某种原因,枚举的实例保存在堆中.
为了模拟它,我已经在tomcat中部署了我的应用程序,稍微使用它,停止它并在tomcat上执行GC(通过jconsole).然后拿了一个heapdump发现了这个:
instance of x.mgbean.quote.Input$Tab@0xe0887c0 (16 bytes)
Class:
class x.mgbean.quote.Input$Tab
Instance data members:
name (L) : VEHICLE (24 bytes)
ordinal (I) : 0
References to this object:
java.util.HashMap$Entry@0xe15f7c0 (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
Run Code Online (Sandbox Code Playgroud)
知道怎么会这样吗?
为什么他们不在堆里?它们是类(枚举类)的实例,与所有其他对象一样.这并不意味着他们可以被垃圾收集.他们的类包含对每个实例的引用.
| 归档时间: |
|
| 查看次数: |
764 次 |
| 最近记录: |