第23课:使用MAT对Dump文件进行分析实战
2016-05-29 09:14
901 查看
第23课:使用MAT对Dump文件进行分析实战
/* 王家林老师授课http://weibo.com/ilovepains 每天晚上20:00YY频道现场授课频道68917580*/
1 导出Dump文件
2 使用MAT对Dump文件进行分析实战
一:下载安装mat
www.eclipse.org/mat/downloads.php
解压缩到G:\IMFBigDataSpark2016\mat
点击MemoryAnalyzer.exe即可运行
二:分析oom,我们模拟代码运行
com.dt.spark.jvm.basics 新建OOMMAT
OOMMAT
package com.dt.spark.jvm.basics;
public class OOMMAT {
public static void main(String[] args) {
final int size = 512 *1024 *1024 ;
byte [] array1 =new byte [size];
byte [] array2 =new byte [size];
byte [] array3 =new byte [size];
byte [] array4 =new byte [size];
byte [] array5 =new byte [size];
}
}
vm conf
-server -Xms1024m -Xmx1024m -Xmn384m -XX:+UseParallelOldGC
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDateStamps
-XX:+PrintGCDetails
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=d:/heap.bin
result:
2016-05-29T09:16:25.534+0800: [GC (Allocation Failure) [PSYoungGen: 17694K->753K(344064K)] 541982K->525045K(999424K), 0.0076781 secs] [Times: user=0.03 sys=0.00, real=0.01 secs]
2016-05-29T09:16:25.541+0800: [Full GC (Ergonomics) [PSYoungGen: 753K->0K(344064K)] [ParOldGen: 524292K->525014K(655360K)] 525045K->525014K(999424K), [Metaspace: 1748K->1748K(4480K)], 0.0121461 secs] [Times: user=0.00 sys=0.02, real=0.01 secs]
2016-05-29T09:16:25.554+0800: [GC (Allocation Failure) [PSYoungGen: 0K->0K(344064K)] 525014K->525014K(999424K), 0.0049526 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
2016-05-29T09:16:25.559+0800: [Full GC (Allocation Failure) [PSYoungGen: 0K->0K(344064K)] [ParOldGen: 525014K->525004K(655360K)] 525014K->525004K(999424K), [Metaspace: 1748K->1748K(4480K)], 0.0060592 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
2016-05-29T09:16:25.565+0800: Total time for which application threads were stopped: 0.0313803 seconds, Stopping threads took: 0.0000611 seconds
java.lang.OutOfMemoryError: Java heap space
Dumping heap to d:/heap.bin ...
2016-05-29T09:16:36.936+0800: Total time for which application threads were stopped: 11.2751442 seconds, Stopping threads took: 0.0001066 seconds
Heap dump file created [538171422 bytes in 11.372 secs]
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at com.dt.spark.jvm.basics.OOMMAT.main(OOMMAT.java:8)
Heap
PSYoungGen total 344064K, used 8847K [0x39600000, 0x51600000, 0x51600000)
eden space 294912K, 3% used [0x39600000,0x39ea3ef8,0x4b600000)
from space 49152K, 0% used [0x4e600000,0x4e600000,0x51600000)
to space 49152K, 0% used [0x4b600000,0x4b600000,0x4e600000)
ParOldGen total 655360K, used 525004K [0x11600000, 0x39600000, 0x39600000)
object space 655360K, 80% used [0x11600000,0x316b31c0,0x39600000)
Metaspace used 1769K, capacity 2242K, committed 2368K, reserved 4480K
三:MemoryAnalyzer.exe打开d:/heap.bin文件,就可以查看各类运行情况
操作步骤截图
相关文章推荐
- iOS开发-即时通信XMPP
- iOS开发-即时通信XMPP
- foreach 和 for 循环的区别
- Shader Forge 的纹理
- C++笔试题之String类的实现
- PHP基础四:数据库操作
- 第二阶段站立会议第三天
- 第二阶段工作总结 06
- 用java输出高度为n的直角三角形
- hdu2874 Connections between cities(LCA离线+并查集)
- poj3321 Apple Tree
- 是非观
- 类对象的生存周期
- 传感器系列之3.4继电器
- 函数参数代码实例
- 图片放大镜
- Java千百问_07JVM架构(012)_fullGC、minorGC、magorGC有什么区别
- PHP基础三:PHP7新特性&SPL
- [Ruby笔记]17.Ruby attribute attr_reader attr_writer attr_accessor attr
- GUID