public static void testStackOutOfMemory(){
while (true) {
Thread thread = new Thread(new Runnable() {
public void run() {
while(true){}
}
});
thread.start();
}
}
上面这个必死,下面这个没试过
public static void testStackOutOfMemory() {
while (true) {
new Thread(() -> {
while (true) {
}
}).start();
}
}