Memory Analysis内存分析工具复习

最近因为系统问题,所以又对Memory Analysis工具进行复习(for eclipse的)

通过dump出来的文件,然后在eclipse上用Memory Analysis工具(可以在线安装很简单)

内存泄漏查找思路一:

打开Leak Suspects->Problem Suspect N下的“Details”

打开此页面后,有几个内容:

1、引用累计关系(shortest paths to the accumulation point)

2、存储对象(accumulated objects)

3、存储对象所属类名(accumulated objects by Class)

 

这种方式很简单并且很直观,知道那些对象了去查找类和引用点。

 

内存泄漏查找思路二:

1、打开直方图(Histogram),过滤找到自己的类,然后在此记录上右键“list objects”下选择“with incoming references”

得到是那些对象引用了此类。

2、再从这些对象记录选择一条右键“Path to GC Roots”->"exclude weak references",得到层次引用关系,就知道了point。

如果对代码很熟悉,能猜出是那个类会引起泄漏,就可以用这种方式

 

 

备注:

Shallow vs. Retained Heap

Shallow heap is the memory consumed by one object. An object needs 32 or 64 bits (depending on the OS architecture) per reference, 4 bytes per Integer, 8 bytes per Long, etc. Depending on the heap dump format the size may be adjusted (e.g. aligned to 8, etc...) to model better the real consumption of the VM.

Retained set of X is the set of objects which would be removed by GC when X is garbage collected.

Retained heap of X is the sum of shallow sizes of all objects in the retained set of X, i.e. memory kept alive by X.

 

关于相关更详细的资料可以参考帮助和网上资料。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值