Loader/unload() 是垃圾收集的必需品吗?
Is Loader/unload() a must for garbage collection?
我正在使用 flash.display.Loader 加载外部 SWF。
当我处理完 SWF 后,是否足以手动删除对加载程序和 SWF 内容的所有引用以释放它以进行垃圾回收?或者我还必须调用 Loader/unload()?
从Loader的ASDocs可以看出
When you call the unload() method, the Loader object's contentLoaderInfo property is set to null. Any visual assets that were loaded with the SWF are unloaded and removed from memory. ActionScript class definitions in the loaded SWF remain in memory, and code in the same application domain as the loaded SWF can access instances of those classes and create new instances.
我认为从内存中删除它的最好和最安全的方法是删除所有事件侦听器,卸载并将加载器设置为空。
我正在使用 flash.display.Loader 加载外部 SWF。
当我处理完 SWF 后,是否足以手动删除对加载程序和 SWF 内容的所有引用以释放它以进行垃圾回收?或者我还必须调用 Loader/unload()?
从Loader的ASDocs可以看出
When you call the unload() method, the Loader object's contentLoaderInfo property is set to null. Any visual assets that were loaded with the SWF are unloaded and removed from memory. ActionScript class definitions in the loaded SWF remain in memory, and code in the same application domain as the loaded SWF can access instances of those classes and create new instances.
我认为从内存中删除它的最好和最安全的方法是删除所有事件侦听器,卸载并将加载器设置为空。