import java.lang.reflect.Field; import sun.misc.Unsafe; public class TestThreadStackSize { private static void crashVM() { try { makeSegfault(getUnsafe()); } catch (Exception e) { // swallow } } private static Unsafe getUnsafe() throws Exception { Field f = Unsafe.class.getDeclaredField("theUnsafe"); f.setAccessible(true); return (Unsafe) f.get(null); } private static void makeSegfault(Unsafe u) throws Exception { u.getInt(0); } public static void main(String[] args) throws Exception { Thread t = new Thread(new Runnable() { public void run() { crashVM(); } }); t.start(); t.join(); } }