一个可以把windows系统跑死的Java程序

public class JavaVMStackOOM {
 
    private void dontStop(){
        while (true){}
    }
 
    public void stackLeakByThread(){
        while (true){
            Thread thread = new Thread(){
                @Override
                public void run() {
                    dontStop();
                }
            };
            thread.start();
        }
    }
 
    public static void main(String []args){
        JavaVMStackOOM oom = new JavaVMStackOOM();
        oom.stackLeakByThread();
    }
}

疯狂创建线程

posted @ 2019-12-01 21:57  AmosAlbert  阅读(76)  评论(0编辑  收藏  举报