?????дJava??????Jvm????
???????????? ???????[ 2014/4/28 9:59:12 ] ????????Java Jvm
??????????????????????????????“?????????дJava??????Jvm????”??????????????????????????????£????????????????????????
1 package jvm;
2
3 public class Crash {
4 public static void main(String[] args) {
5
6 //Object[] o = {“abc”};??????????????????
7 Object[] o = null;
8
9 while (true) {
10 o = new Object[] { o };
11 //????????jvm?????????
12 //System.out.println(o);
13 }
14 }
15 }
???????????????????????????????????????
????Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
????at jvm.Crash.main(Crash.java:10)
???????????????????????
?????????????????????£??縳?????????????????
?????????????????е?o??????????????jvm??????????????????????????????????????
????????????????????Jvm?????????????????У???????????????????μ?????????????????????????????GC????????????????????????
??????????????????д??????????????????????е????飬???£?
1 package jvm;
2
3 public class JvmBean {
4
5 JvmBean bean = new JvmBean(this);
6
7 public JvmBean(JvmBean bean){
8 this.bean = bean;
9 }
10 }
????????????????£?
1 package jvm;
2
3 public class MyCrash {
4
5 public static void main(String[] args) {
6 JvmBean j = null;
7 while(true){
8 j = new JvmBean(j);
9 //??????????????jvm???????
10 //System.out.println(j);
11 }
12 }
13 }
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11