在ActionScript 3中卸载的ByteArray [英] Unloading a ByteArray in Actionscript 3

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

问题描述

我如何强制卸载的ByteArray 从内存在ActionScript 3?

我曾尝试(没有成功):

  byteArray.length = 0;
的字节数组=新的ByteArray();
 

 的(VAR我:= 0; I< byteArray.length;我++){
    的字节数组[我] = NULL;
}
 

解决方案

我不认为你有什么可担心的。如果 System.totalMemory 下山你可以放松。它很可能是一个不收回新释放的内存(在期待下一次Flash Player将要求更多的内存)操作系统。尝试这样做,这是非常内存密集型别的东西,我敢肯定,你会发现,分配给Flash播放器内存会降低,用于其他工艺代替。

正如我的理解,在现代操作系统的存储器管理是不是从看分配给每个进程,或者甚至分配的总金额的金额的透视直观。当我用我的Mac 5分钟,我95%的3 GB的RAM时,它会保持这种方式,它永远不会下降。这只是操作系统处理内存的方式。只要它并不需要一个已经退出仍然分配给他们的内存,即使在其他地方的进程(这可以让他们更快的启动下一次,例如)。

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

I have tried (without success):

byteArray.length = 0;
byteArray = new ByteArray();

and

for ( var i:int=0; i < byteArray.length; i++ ) {
    byteArray[i] = null;
}

解决方案

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). 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. 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天全站免登陆