?????????????2??????У?-Xmx10M -Xms10M M  ??jvm???С?????10M??????????????????ü???????t1??t2???????????????ü????????????0?????????????????????????????????JVM??10M??t1 t2???8m???????μ?2M????????????t3???????????????OOM???????????????????????????JVM??????????t1??t2?????????-XX??+PrintGCDetails???У??????GC?????????


[GC [DefNew: 252K->64K(960K)?? 0.0030166 secs][Tenured: 8265K->137K(9216K)?? 0.0109869 secs] 8444K->137K(10176K)?? [Perm : 2051K->2051K(12288K)]?? 0.0140892 secs] [Times: user=0.01 sys=0.00?? real=0.02 secs]
com.mail.czp.Test@2ce908
Heap
 def new generation   total 960K?? used 27K [0x029e0000?? 0x02ae0000?? 0x02ae0000)
  eden space 896K??   3% used [0x029e0000?? 0x029e6c40?? 0x02ac0000)
  from space 64K??   0% used [0x02ad0000?? 0x02ad0000?? 0x02ae0000)
  to   space 64K??   0% used [0x02ac0000?? 0x02ac0000?? 0x02ad0000)
 tenured generation   total 9216K?? used 4233K [0x02ae0000?? 0x033e0000?? 0x033e0000)
   the space 9216K??  45% used [0x02ae0000?? 0x02f02500?? 0x02f02600?? 0x033e0000)
 compacting perm gen  total 12288K?? used 2077K [0x033e0000?? 0x03fe0000?? 0x073e0000)
   the space 12288K??  16% used [0x033e0000?? 0x035e74d8?? 0x035e7600?? 0x03fe0000)
No shared spaces configured.


?????????????????????????GC?????????t1  t2???????????jvm???????????????ж????????????????

????????????????????????????????????????ж??????GC?????????????????Щ?????????????????GCRoot??????Щ????????????????????Щ?????????????????γ??????·????????????Щ??????κ???·????????????ж????????????????Щ??????????????????????????????????????á??????????????????????????????????test()?????е?Date d??new Date()?????????????????????У??????t3???jvm?????????????????????????????GC?????t1??t2??????????????t1=t2=null??????????????3?????????е??κ???????????????GC???ж???????????????????????????????t3????????????????л???????仹?????????????OOM??

???????????????????GC ????????????????汾??Hotspot????????÷??????????????heap???????????????????????????????

????????????????????90% ???????10%?????????????????????eden????????survivor??????????eden?????е????survivor????????????eden?????е????survivor????????????Щ??????????????????????????????????????????????????????????????byte[] buffer = new byte[1024*1024]?????????????????????????佫??????????????治????????gc??GC????????????л????????????У??????Щ??????????????????????survivor????У?????????eden?????????survivor???????е???????????????????????????????????Щ??????д??finalize?????????GC?????Щ??????????????????????????????????????finalize????????????????????Щ??и?дfinalize?????????????????????????????????????survivor????????п????????????????????????????GC????????Щ???????????????У??????????????????????????????Full GC??Full gc??????????????Щ??к??κ?GC Root????????????Full GC??????滹????????????OutofMemoryError??

????Hotspot???????java????????????????????????????????????java??????????