publicstaticvoidmain(String[] args)throws Exception { List<Student> students = new ArrayList<>(); for (int i = 0; i < 200; i++) { students.add(new Student()); } Thread.sleep(10000000000L); }
}
classStudent{ privatebyte[] big = newbyte[1024 * 1024]; }
由于 students 一直存储着 student 对象,导致,并且一直被使用,导致,GC 没办法回收,内存占有率,居高不下。