伪美&生活
-
2009-02-21
flex magic bug3:几个垃圾回收的问题或bug - [flex|flash]
版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://avant-contra.blogbus.com/logs/35513770.html
恶战了几天flex的垃圾回收,小有结果,包括:
1 在module中用<mx:Style>方式引入css文件(编译期),则,扯淡。经测试目前找到两种解决方法,一种是把<mx:Style>放到main app domain中去,因为module默认会继承main domain的css;第二种是把css编成swf后,在module中动态加载。估计module在编译期引入css时,会引用到main domain中的东西,造成无法GC。
2 mate框架中的Injector方法,类似映射或绑定,非常好用,但是很不幸,测试了n次后发现Injector会带来无法GC的问题,最近是没空再去翻mate源码了,用as自己的bindingUtil代替后问题解决。但mate maker说Injector不会产生GC问题。。。magic。
3 冷到家的一个bug。。。memory leak when using TextInput and TextArea when click the keyboard 只要用TextInput之类的组件,就无法垃圾回收,连这个都让我测试出来了- -b真不容易,可惜的是在上述链接中发现flash player team正在解决ing。。。于是到这一步垃圾回收战可以打住了,因为实在无法避免不用TextInput - -b,总得注册登录吧。。。爱谁谁,估计最后内存占用会超过100M……
以下是几个介绍垃圾回收的链接(决定以后按时阅读flex bug list。。。以上几个bug自己测出来太bt了):
http://roshantitus.blogspot.com/2008/11/flex-memory-management.html
http://www.cnblogs.com/janyou/archive/2008/11/25/1340753.html
http://www.nutrixinteractive.com/blog/?p=132
http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html
http://blogs.adobe.com/aharui/2007/03/garbage_collection_and_memory.html


评论
只看到一个http://mate.asfusion.com/forums/topic.php?id=728
请教博主有没有类似的 mate下 module unload/reload/ Injector的经验?
另,mate的作者说新版本的mate框架,已经解决了GC的问题,不过我没有测试过。