1: Testing a test overflow, modify the heap memory size
// 模拟内存溢出 -Xms10m -Xmx10m private static void mockOOM() { List list = new ArrayList(); for(int i = 0; i < 1000000; i++) { list.add(new Object()); } }
Right inside the program run as in the run configuration settings:
-XX:+HeapDumpOnOutOfMemoryError -Xms10m -Xmx10m