堆溢出处理
import java.util.Vector;
/**
* Created by xxd on 2017/4/2.
*/
public class DumpOOM {
public static void main(String[] args){
Vector v = new Vector();
for (int i=0;i<25;i++){
v.add(new byte[1*1024*1024]);
}
}
}
使用MAT工具分析堆内存溢出,下载地址:http://www.eclipse.org/mat/-Xmx20m -Xms5m "-XX:OnOutOfMemoryError=D:/tools/jdk1.7_40/bin/printstack.bat %p" -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=d:/a.dump