简体   繁体   English

什么是Flash电影可以在浏览器中使用的最大内存?

[英]Whats the maximum memory that a Flash movie can use in a browser?

I need to store a lot of data coming in from a server into memory, so I have to write my memory-storage algorithms based on how much I can safely use without hanging up or crashing the browser. 我需要将大量来自服务器的数据存储到内存中,因此我必须根据可以安全使用的内容编写内存存储算法,而不会挂起或崩溃浏览器。

Is there any safe size limit like 1MB or 100MB, that contents of global variables should not exceed? 是否有任何安全大小限制,如1MB或100MB,全局变量的内容不应超过?

There's no hard and fast limit, but for flash game development targeting mid-to-low end machines, we found that keeping our memory footprint below 500MB reduced random crashing significantly. 没有硬性和快速限制,但对于针对中低端机器的Flash游戏开发,我们发现将内存占用量保持在500MB以下可以显着减少随机崩溃。 :-D You'll probably see other scalability limitations (processing power, single threadedness) way before you see memory capacity limitations, unless you are generating a lot data locally, procedurally (eg with generated bitmaps.) :-D你可能会在看到内存容量限制之前看到其他可扩展性限制(处理能力,单线程)方式,除非你在本地,程序上生成大量数据(例如使用生成的位图)。

I always recommend switching to AS3, but I don't think memory management will be a show-stopper in AS2. 我总是建议切换到AS3,但我认为内存管理不会成为AS2中的显示器。

You can check how much memory you are using with: 您可以检查您使用的内存量:

trace("MEMORY USAGE: " + (System.totalMemory/1048576) + "MB");

Use this to help keep locate memory leaks and to improve your garbage collection code. 使用它来帮助保持定位内存泄漏并改进垃圾收集代码。

In actionScript 2 they say you should both clear and delete dynamically created objects for quickest GC. 在actionScript 2中,他们说你应该清除和删除动态创建的对象,以获得最快的GC。

myArray[0] = "value";

myArray[0] = null; // to Garbage Collect
delete myArray[0];

Have a look at this very similar question and as stated there as well, what you're after might be here . 看看这个非常相似的问题,并在那里说明,你所追求的可能在这里

Goodluck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM