??????????????????????????????????????????????й?????????????????????????

????????????????????????????????????й??????????????????й?????????;??????????????GC???????;???????????????????????;????????????????ν?????????

???????濪???????????

??????????? ????

?????????????java?е????java?????????????????????C++?????????????????????java???????????????????????????????????????????????е???????????????????????????????????????????????????й??????????????????????static??????????????????е????????????????????????static??????

 

?????????????java??治???????java???????????????? System.gc()????????????????jvm?????????Щ???????????????????檔java??????????jvm??gc?????й漲gc??ι???????????????????????????????????gc???????????????????????????????????????

?????????У??????????????????java???????泬???????????????????????????????????????

???????й??????????????????????????(new)????????????????????黹(delete)?????????????????????????????????????????????????????????????????????????????????????????????????????????????ν????????????????????й?????????????????????????????????


??????????? ???

????JAVA????????????????????


??????Java??????淶?У??????????????????????


?????? ????(Stack)??????????е??


?????? ?????(Heap)??????????????

 

?????? ??????(Method Area)???е???????????????????Ρ????????????????????????????????????????????????????????


?????? ????????(Native Method Stack)?????????JNI?е???????????????漰??


??????Java???????????棬java??????????????????????????(????)???з?????Java?????(JVM)????д????????????е???ó??????????????ж???????????????????????????(Heap)?й??

 

??????????????????JAVA?????(JVM)??????Щ?????????????????????????????????????????????????alive????????б?????????????????????????????dead????????????????????????dead??????????????????????????????????????????????????????е??У?????????

????JVM????????????????????????(generational )?????????y???????????????(young generation)???????????????????minor collection???????????(old generation)??????????????????major collection??????????????GC????????????ж????????飬???????????????????????

????(Sun JVM 1.3 ???????????????????????????copying??scavenge????????????????????????????????????????????????????Ч????????????????????棬??????п????????????????minor collection???????????mark-compact??????????????????????????????????????棬????????????????????????????????????????????????Щ?????????????major collection. )

 

?????Щ?????????????????ж????????????????? iterators ??????????


?????????Щ????????????к????????????????? ???????????

????????????????????????????????????????????????????????????????????顣?????????????????????????????JVM??????????????????????????GC(??????minor collection)????????????????dead?????????????????檔???GC??????Full GC?????


????JVM???????????????????(yong generation)(????????nursery???ж???)???????(old generation)??????????? ??Eden space(?????)??????????survivor spaces?????????????????????????ж??????? Eden space?????????????????????????? ?????? minor GC?????VM?????μ????????????Eden space????????????survivor spaces???С?????VM??????Щ????????survivor spaces ??????????? ?????????tenured?? space?С??? tenured generation ?????????????Full GC??Full GC?????????????????????????????е? live???????pemanet generation???????????????java?????????????????????????????????????????????


????????????????????????л??????????


???????????????????????????????????????????????????????????????????С?????????????????JConsole????????????????????????????????????????????????????????????????????ο????μ???????

????Tuning Garbage collection with the 5.0 HotSpot VM

????http://java.sun.com/docs/hotspot/gc/index.html

?????????????????棺

????Eden Space (heap)?? ????????????????????????

????Survivor Space (heap)???????????eden space?????о??????????????б?????????

????Tenured Generation (heap)?????????????? survivor space?????д???????????????

????Permanent Generation (non-heap): ????????????????(refective)???????????(class)?????(method)????Java???????????Щ?????????????????????????д???