“FlashPlatform GC”的版本间的差异

来自Blueidea
跳转至: 导航搜索
垃圾回收機制
第11行: 第11行:
  
 
計數法<br/>
 
計數法<br/>
通常用來描述垃圾回收機制但並為作為唯一的回收手段。
+
通常用來描述垃圾回收機制但並為作為唯一的回收手段。<br/>
[[Image:FlashPlatform_GC_count.png]]
+
<center>[[Image:FlashPlatform_GC_count.png]]</center><br/>
 
=== 參考資料 ===
 
=== 參考資料 ===
 
[[http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html Flash的垃圾回收]]
 
[[http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html Flash的垃圾回收]]
 
[[http://en.wikipedia.org/wiki/Garbage_collection_(computer_science) 垃圾回收機制]]
 
[[http://en.wikipedia.org/wiki/Garbage_collection_(computer_science) 垃圾回收機制]]

2011-04-17T08:17:01的版本

引用和對象

首先需要達成一個共識。

 我們在ActionScript3中操作對象所使用的都是引用(指針),而非對象本身。
 所以當你刪除一個變量,被刪除的是引用。而不是對象本身。

要了解如何优化你的ActionScript 3.0代码。就需要對垃圾回收的工作原理有所瞭解。

垃圾回收機制

ActionScript3的垃圾回收機制使用兩種方式。

 FlashPlatform Numbers1.jpgreference count 如果一個對象的引用次數為0,那麼幹死。
 FlashPlatform Numbers2.jpgmark and sweep 標記並清除,在DOM種從root向下遍歷並標記。清除沒有被標記的。

計數法
通常用來描述垃圾回收機制但並為作為唯一的回收手段。

文件:FlashPlatform GC count.png

參考資料

[Flash的垃圾回收] [垃圾回收機制]