是removeChild之足以完全删除Flash Player的内存影片剪辑? [英] Is removeChild enough to completely remove a movieclip from Flash Player memory?

查看:175
本文介绍了是removeChild之足以完全删除Flash Player的内存影片剪辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问这行

clip.removeChild(clip.getChildAt(0));

完全删除剪辑的孩子在0指数?我读的地方,你应该设置为到所有引用该剪辑,但我有我的code没有其他的参考。在0剪辑是通过定期添加的addChild()

completely remove the child of clip at 0 index? I read somewhere you should set to null to all the references to that clip, but I have no other reference in my code. The clip at 0 was added via a regular addChild().

推荐答案

有关垃圾收集轻扫你的对象,你应该:

For the garbage collector to swipe your object you should:

-not have any other reference to the object throughout your code
-the object shouldn't be part of any collection (like Array or Vector)
-the current reference should be set to null

一定要格外注意第二个条件中,最常见的情况,当对象是你无法控制集合的一部分,直接是当它有一个监听器连接到它时是显示列表的一部分。最重要的是,还有其他的情况下,当对象是你可以控制一个集合的一部分,不要忘了删除它形成有太多。

Be sure to pay extra attention to the second condition, the most common situation when the object is part of a collection you can't control directly is when it had a listener attached to it and when is part of the display list. On top of that, there are other situations when the object is part of a collection you can control, don't forget to remove it form there too.

另外,迫使垃圾收集轻扫你的对象(仅用于测试,不生产),你可以使用的System.gc(),然后检查与内存 System.privateMemory

Also, to force the garbage collector to swipe your object (only for testing, not production), you can use System.gc() and then check the memory with System.privateMemory

这篇关于是removeChild之足以完全删除Flash Player的内存影片剪辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆