JVM问题排查——OOM

转载自:https://blog.csdn.net/m0_46311226/article/details/104996664

 

 

 

import java.util.ArrayList;

public class TestOOM {

    static class OOMObject {
        private String content;

        public OOMObject(String content){
            this.content = content;
        }
    }

    public static void main(String[] args) {
        ArrayList<OOMObject> list = new ArrayList<>();
        int i = 0;
        while(true){
            list.add(new OOMObject(i+++""));
        }
    }
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2021-03-03 18:05  拥抱天空  阅读(67)  评论(0编辑  收藏  举报