解 决 办 法 : 设 置 堆 内 存 大 小 -Xms1m -Xmx70m -XX:+HeapDumpOnOutOfMemoryError
public static void main(String[] args) throws InterruptedException {
List<Object> list=new ArrayList<>();
Thread.sleep(3000);
jvmInfo();
for (int i = 0; i < 10; i++) {
System.out.println("i:"+i);
Byte [] bytes= new Byte[1*1024*1024];
list.add(bytes);
jvmInfo();
}
System.out.println("添加成功...");
}