freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

瀏覽器內(nèi)存泄漏word版(參考版)

2024-08-28 05:50本頁面
  

【正文】 } /script /head body onload=SetupLeak() onunload=BreakLeak() div id=LeakedDiv/div /body /html 個人看法,大家繼續(xù)討論...被內(nèi)存泄漏折騰壞了,好像firefox也有.18。 } function SetupLeak() { // The leak happens all at once new Encapsulator((LeakedDiv))。 } 那就產(chǎn)生內(nèi)存泄漏了. 因?yàn)樵谠瓉淼哪莻€代碼中,myGlobalObject只是一個變量,指向domobj,而自身并不是一個jsobject. 這段代碼應(yīng)該是在微軟官方的文章上改的,不過好像改失敗了,囧... 原文這樣的: html head script language=JScript function Encapsulator(element) { // Set up our element = element。 function SetupLeak() // 產(chǎn)生循環(huán)引用,因此會造成內(nèi)存泄露 { // First set up the script scope to element reference = (LeakedDiv)。 又正是因?yàn)镃lickEventHandler()是一個內(nèi)嵌函數(shù),因此會為這個實(shí)例構(gòu)造一個scope,這個scope中包括了父函數(shù),也就是 AttachEvents()函數(shù)中的局部變量和參數(shù),而這兒的參數(shù)剛好就是element,所以ClickEventHandler()函數(shù)的實(shí)例同時 又間接引用了element。 大致的原因是因?yàn)镃lickEventHandler()是AttachEvents()的一個內(nèi)嵌函數(shù), AttachEvents()函數(shù)執(zhí)行后,把ClickEventHandler()函數(shù)綁定在element對象的onclick事件上。 ============================ 如果你問的是第二段代碼,那么就比較復(fù)雜了。 這樣myGlobalObject和DOM對象 LeakedDiv 分別有引用指向?qū)Ψ剑跃脱h(huán)引用了。 則 myGlobalObject有了一個指向DOM對象 LeakedDiv 的引用, 而后 ( LeakedDiv ).expandoProperty = myGlobalObject。當(dāng)銷毀頁面時,會中斷循 環(huán)引用。當(dāng)頁面消失時(當(dāng)您瀏覽完,離開瀏覽器時)會釋放內(nèi)存。在這里,您將創(chuàng)建許多元素,Internet Explorer 需要保存它們以正確呈現(xiàn)頁面。 / body / html MS是這么解釋的,這不是內(nèi)存泄漏。} / script foo() scriptInsert / button onclick = LeakMemory() Memory} 。foo() = = memoryManageratlot,it // {LeakMemory() script head btw:IE 6中垃圾回收算法,就是從那些直接in scope的對象開始進(jìn)行mark清除的:Every variable which is in scope is called a scavenger. A scavenger may refer to a number, an object, a string, whatever. We maintain a list of scavengers – variables are moved on to the scav list when they e into scope and off the scav list when they go out of scope.PseudoLeaks 這個被稱為“秀逗泄露”真是恰當(dāng)?。海┛纯催@個例子: html 可惜的是,IE不會釋放剛才那個臨 時的scope對象的內(nèi)存空間,直到我們跳轉(zhuǎn)頁面,這塊空間才能被釋放。原因是LeakMemory()會先建立起parentDiv和childDiv之間的連接,這時候,為了讓 childDiv能夠獲知parentDiv的信息,因此IE需要先建立一個臨時的scope對象。 / body / html LeakMemory和CleanMemory這兩段函數(shù)的唯一區(qū)別就在于他們的代碼的循序,從代碼上看,兩段代碼的邏輯都沒有錯。id = hostElement / div onclick = CleanMemory() CleanLeaking button body / head / script } = null 。childDiv = (childDiv)。(childDiv)。tthisisthe // foo()39。 ( divchildDiv )。onClick=39。 = var {i ++ ) 5000 。i 0 。 for (iresponse forTasklookaDo( hostElement )。hostElement // 而這個函數(shù)不會引發(fā)CrossPage function } = null 。childDiv = (childDiv)。(parentDiv)。temporaryleakThis )。onClick=39。childDiv )。onClick=39。parentDiv = memoryManageratlot,it // = var {Leaks LeakMemory() script head 大家可以看看這段例子代碼: html CrossPage Leaks和下一節(jié)提到的PseudoLeaks在我看來,就是IE的bug, 雖然MS死皮賴臉不承認(rèn):)詳細(xì)見。 h1Click me!/h1/div/body/html backgroundcolor: yellow。width:100%。testCase39。39。 }/script/headbody onload=39。returntrue。}}。 = // remaining theridtoregistryoff // }}}type,( on { if IEstyleuseCapture)。(type,{ if listeners? // { with {i 0 。i for {CleanUp: */ eventtheup* false 。 true 。 false })。fn,type,obj,fn)) + amp。 if listeners? // } return useCapture:fn:type: this .({obj:fn,()Mozilla/W3C false 。 null )fn null (obj(obj)。obj{ == ( typeof anit39。passedstringIf this .Initialise()。{fn, function (obj,false.registered,ifreturn*ignoreunderstanddon39。Ifdefault.Falseevent*Handlerfnparamto.handlerof*attachedwillObject*manager.withandan* this .CleanUp)。(window,unload. oncleanupRegister[]。 this ._registry{ == if {Initialise:
點(diǎn)擊復(fù)制文檔內(nèi)容
語文相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1