Garbage Collection

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

l Garbage Collection:

l 讓物件能”有機會”被garbage collected的方法:

n nulling a reference

n reassigning a reference value

n isolating a reference

l gc runs in low memory situations。VM將此thread的priority設為0(最低)。

l 當系統有其它thread在運作時,就不會進行GC。

l 只有gc可以destroy 一個object。

l Runtime.getRuntime().gc() / System.gc()

l finaliaze被呼叫的時機為真正做gc之前。

l The finalize method of each instance can only run once

l String s = “Hello”; String s = nothing; è is not garbage collected

String s = new String(“Hello”); String s = nothing; è is garbage collected

来自:【 Garfield 的 SCJP 閱讀筆記 】

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航