竹笋

注册

 

发新话题 回复该主题

JVM结合MAT工具来分析OOM问题 [复制链接]

1#
白癜风专科医院 http://www.bdfyy999.com/m

简单来演示一下OOM的分析和实战。

直接上代码:

publicclassDemo4{publicstaticvoidmain(String[]args){ListDandanlist=newArrayList();while(true){list.add(newDandan());}}}classDandan{}

JVM参数:

-XXUseParNewGC-XXUseConcMarkSweepGC-Xms10m-Xmx10m-XXPrintGCDetails-Xloggcc_dandan.log-XXHeapDumpOnOutOfMemoryError-XX:HeapDumpPath=./

运行后的日志:

java.lang.OutOfMemoryError:JavaheapspaceDumpingheapto./java_pid.hprof...Heapdumpfilecreated[bytesin0.secs]Exceptioninthreadmainjava.lang.OutOfMemoryError:Javaheapspaceatjava.util.Arrays.copyOf(Arrays.javaatjava.util.Arrays.copyOf(Arrays.javaatjava.util.ArrayList.grow(ArrayList.javaatjava.util.ArrayList.ensureExplicitCapacity(ArrayList.javaatjava.util.ArrayList.ensureCapacityInternal(ArrayList.javaatjava.util.ArrayList.add(ArrayList.java:)at

分享 转发
TOP
发新话题 回复该主题