-Xss128k
package com.example.oom; public class JavaVmStackSOF { public int getStackLength() { return stackLength; } private int stackLength = 1; public void stackLeak() { stackLength++; stackLeak(); } }
class JavaVmStackSOFTest { @Test public void test() { JavaVmStackSOF sof = new JavaVmStackSOF(); try { sof.stackLeak(); } catch (Throwable throwable) { System.out.println("stack length: " + String.valueOf(sof.getStackLength())); throw throwable; } } }
-Xss1000M
最终还是SOF,但是stack length达到了6000W
原文:https://www.cnblogs.com/Brake/p/12879533.html