久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

android Avoid Memory Leaks 內(nèi)部類問題

 xue_dong5437 2011-08-17
An inner class holds a reference to the object instance that created it; 
thus, in the following: 
public class Outer 
  public class Inner 
  { 
  } 
  Inner i = new Inner(); 

Outer o = new Outer; 
Outer.Inner oi = o.i; 
o = null; 
  // o is still alive because oi references it 
oii has a hidden reference (the "outer this") to the enclosing class 
instance o. So long as somebody holds a reference to the Inner object, the 
reference to the outer object remains alive. 
If you mark the enclosing class or enclosing method as static, the inner 
class will be a static inner class, which holds no reference to the 
enclosing class (and also therefore lacks the ability to referencere fields 
and methods of the outer class). 
Event listeners were a common source of leaks (meaning, longer-lived objects 
than intended) in Swing code back in the day. Might try hunting around that 
way on Google--there used to be a great article on "four types of lapsed 
listeners" back then, that described all of this in more detail. 

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點,。請注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,,謹防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請點擊一鍵舉報,。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多