什么是在Flash / AS3良好的内存管理技术 [英] What are good memory management techniques in Flash/as3

查看:149
本文介绍了什么是在Flash / AS3良好的内存管理技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我pretty的熟悉的Java,C和C ++的内存管理;但是,在Flash什么结构都存在于内存管理?我假设闪光灯的有点像Java虚拟机,而我一直在假设事情变得垃圾回收时,他们都设置为null。我不知道这是否是真正的情况,虽然。也就是有没有办法来强制垃圾收集在Flash?任何其他提示?

So I am pretty familiar with memory management in Java, C and C++; however, in flash what constructs are there for memory management? I assume flash has a sort of virtual machine like java, and I have been assuming that things get garbage collected when they are set to null. I am not sure if this is actually the case though. Also is there a way to force garbage collection in Flash? Any other tips?

感谢

推荐答案

FLASH字节code是由AVM(ActionScript虚拟机)上运行。总体而言(而不是进行Java中的专家或Flash Player的内部),我认为这是肯定地说,AVM模式有些模拟到JVM的模型(来源$ C ​​$ C被编译成字节code,这是由虚拟机上运行;在AVM,至少,还有一部分是PTED跨$ P $和一些被JIT编译为本地code执行之前,等等)

Flash bytecode is run by the AVM (Actionscript Virtual Machine). In general terms (and without being an expert in Java or the internals of the Flash Player), I think it's safe to say that the AVM model is somewhat analogue to the JVM model (source code is compiled to bytecode, which is run by the VM; in AVM, at least, some of it is interpreted and some is JIT compiled to native code before execution, etc).

AVM是,如你所说,垃圾回收,所以基本内存分配和释放是为您的GC管理。当一个物体变得无法访问,这是符合GC(这并不意味着它正在收集的时候了)。

AVM is, as you said, garbage collected, so basically memory allocation and deallocation is managed for you by the GC. When an object becomes unreachable, it's eligible for GC (which doesn't mean it is collected right away).

有一种方法来强制GC周期,只有在播放器的调试版本,也是一个黑客,非官方的和无证,但你可以找到它在谷歌的一些链接(试行GC破解闪光的LocalConnection或类似的这些行)。强制GC几乎总是一个坏主意,但。

There's a way to force a GC cycle, only available in the debug version of the player, and also a hack, unofficial and undocumented, but you can find some links about it in google (try GC hack flash LocalConnection or something along those lines). Forcing a GC is almost always a bad idea though.

我最近碰到过这样的博客文章,解释了如何在一些deatil GC的作品,通过引用AVM C ++源$ C ​​$ C(播放器的一部分是开源的,所以你可以检查出来的更深入的信息,如果你愿意)。的http://jpauclair.net/2009/12/23/tamarin-part-iii-current-garbage-collector-in-flash-10-0/

I've recently come across this blog post that explains how the GC works in some deatil, with references to the AVM C++ source code (that part of the player is open source, so you can check it out for more in depth info if you're so inclined). http://jpauclair.net/2009/12/23/tamarin-part-iii-current-garbage-collector-in-flash-10-0/

这篇关于什么是在Flash / AS3良好的内存管理技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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