jvm性能监控工具

Posted by Xsp on September 7, 2018

内存堆转储快照分析

public class HeapOOM {
	static class OOMObject {
	}
	public static void main(String[] args) {
		List<OOMObject> list = new ArrayList<OOMObject>();

		while (true) {
			list.add(new OOMObject());
		}
	}
}
// java.lang.OutOfMemoryError: Java heap space
// Dumping heap to java_pid5754.hprof ...
// Heap dump file created [27574983 bytes in 0.185 secs]

执行java -Xms20m -Xmx20m -XX:+HeapDumpOnOutOfMemoryError HeapOOM 生成快照文件。