AS3 weak reference & GC
来源:互联网 发布:mac断开vpn不能上网了 编辑:程序博客网 时间:2024/06/05 10:04
一下内容摘自其他blog,并附有连接,讲的很好,希望有对不了解weak reference的有所帮助,当然,主要针对自己
A weak reference is one that is not counted by the Garbage Collector(ie.it is not counted in reference counting,and it is not followed for mark sweeping).This means that if the only references remaining an object are weak,itwill be available for collection on the next GC sweep.References associated with event listeners are often forgotten by developers,which normally results in the listenernever being removed from memory.This is why weakly referenced event listeners are so handy in As3-if you forget toremove the listener,you will not impede the Garbage Collector's ability to collect the object.Recommended:someObj.addEventListener("eventName",myFunc,false,0,true);set the fifth parameter to true;http://gskinner.com/blog/archives/2006/07/as3_weakly_refe.html
AS3 垃圾回收
Garbage Collectordef:The garbage collector is a behind-scenes process that is responsible for deallocating the memory used objectsthat are no longer in use by the application.Inactive obj: it no longer has any references to it from other active objects.Two method:Reference counting: When you create a reference to an object its reference count is incremented.When you delete a reference,its reference count is decremented.If the reference count of an object reaches Zero,it is marked for deletion by the garbage collector.fatal pro:circular referencing.Mark Sweeping:The player starts at the root node of your application and walks through every reference on it,markingeach object it finds.It then iterates through each of the marked objects,marking their children.It continuesthis process,it can safely deallocated.flaw:costly./********************************************************************************************************************************/Deferred GC and IndeterminacyObjects will not be removed immediately when all active references are deleted,instead they will be removed at some indeterminate time in the future(from a developer standpoint).The GC uses a set of heuristics that look at RAM allocation and the size of the memory stack(among other things) to determine when to run.As a developer,you must also be aware that inactive objects will continue to execute indefinitely(until the GC deallocated it),so code will keep running,sounds will keep playing,loads will keep happening,events will keep firing,etc.
0 0
- AS3 weak reference & GC
- Weak Reference
- strong reference and weak reference
- Reference Soft Strong Weak
- weak reference - 1
- weak reference的介绍
- weak reference的理解
- [Java] weak reference 和 soft reference
- Understaning weak reference in Java
- Strong, Soft, Weak, Phantom Reference
- weak reference 与assgin属性
- weak reference 与assgin属性
- Weak References 和 Soft reference
- Weak Reference (弱引用)
- java reference and GC
- 02-Reference & GC
- as3中的资源管理与GC
- GC(通过Reference和GC交互)
- 查看内存
- 编码、解码
- 如何读取用户信息
- mysql 多行数据合并成一行
- android view setVisibility和android:visibility
- AS3 weak reference & GC
- Maven生命周期
- ASP.NET MVC 單元測試系列 (2):可測試性 (Testability)
- Android推送服务(GCM)----GCM Architectural Overview翻译
- 使用HTML5和JS-Recon进行端口扫描
- 用 Java 生成 Java - CodeModel 介绍
- Swiftly语言学习1
- 详解spring 每个jar的作用
- property_get/property_set