使用ActionScript 3卸载ByteArray [英] Unloading a ByteArray using Actionscript 3

查看:79
本文介绍了使用ActionScript 3卸载ByteArray的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用ActionScript 3强制从内存中卸载 ByteArray

How do I forcefully unload a ByteArray from memory using ActionScript 3?

我尝试了以下操作:

// First non-working solution
byteArray.length = 0;
byteArray = new ByteArray();

// Second non-working solution
for ( var i:int=0; i < byteArray.length; i++ ) {
    byteArray[i] = null;
}


推荐答案

我不认为你有什么好担心的。如果 System.totalMemory 掉线,您可以放轻松。很有可能是该操作系统没有回收新释放的内存(预期Flash Player下次会请求更多内存)。

I don't think you have anything to worry about. If System.totalMemory goes down you can relax. It may very well be the OS that doesn't reclaim the newly freed memory (in anticipation of the next time Flash Player will ask for more memory).

尝试执行某些操作否则,这将占用大量内存,并且我相信您会注意到分配给Flash Player的内存将减少并用于其他进程。

Try doing something else that is very memory intensive and I'm sure that you'll notice that the memory allocated to Flash Player will decrease and be used for the other process instead.

我了解到,从查看分配给每个进程的数量甚至分配的总数量的角度来看,现代操作系统中的内存管理并不直观。

As I've understood it, memory management in modern OS's isn't intuitive from the perspective of looking at the amounts allocated to each process, or even the total amount allocated.

当我使用Mac 5分钟后,我的3 GB RAM中的95%已使用,并且它将保持这种状态,它永远不会崩溃。这就是操作系统处理内存的方式。

When I've used my Mac for 5 minutes 95% of my 3 GB RAM is used, and it will stay that way, it never goes down. That's just the way the OS handles memory.

只要其他地方不需要它,即使退出的进程仍然分配有内存(这可以使它们更快地启动)例如,下次)。

As long as it's not needed elsewhere even processes that have quit still have memory assigned to them (this can make them launch quicker the next time, for example).

这篇关于使用ActionScript 3卸载ByteArray的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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