Adobe AIR可以使用的最大内存量是多少? [英] What is the maximum amount memory Adobe AIR can utilize?

查看:687
本文介绍了Adobe AIR可以使用的最大内存量是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为一个我正在考虑构建的游戏做一些快速原型设计。我想要做的主要事情之一是瓷砖类型地图的地图生成。生成地图时,我最终使用大量的内存。我正在为我的测试构建一个随机整数数组的地图。当我尝试生成一个大规模的Flash地图给我的内存不足的错误:

$ $ p $ 错误:错误#1000:系统内存不足。

我已经计算出我可以写入文件来解决这个问题。但有谁知道实际的最大尺寸?我已经尝试过搜索无效。

活动监视器报告ADL正在使用大约500MB真实内存和大约700MB虚拟内存。 System.privateMemory属性似乎与真实内存值相匹配。

作为我在OSX Snow Leopard(64)中用8gb ram开发的一个备注

编辑:

这里我正在运行的示例测试

  var ba:ByteArray = new ByteArray(); 
for(var i:uint = 0; i< 100000000; i ++)
{
ba.writeInt(int(Math.random()* 100));
}

trace(end,ba.length,System.totalMemory);

这个例子运行良好,之后内存属性报告总共使用了大约500MB的ram。
现在将目标值增加到400,000,000我最终收到'内存不足'的错误。
$ b

注意:在Flash CS5.5中进行测试,超时设置为120秒(测试从来没有达到那个时间)

编辑:



我已经创建了一个更好的测试示例:

  var i:uint = 0; 
var loopLength:Number = 500000000; // 500,000,000
var ba:ByteArray = new ByteArray();
$ b for(i = 0; i try {ba.writeInt(1);}
catch(e:Error){
MEM_TI.appendText(e.message);
break;
}
}

ba.position = 0;
MEM_TI.appendText(\ nTM:+ System.totalMemory +FM:+ System.freeMemory +PM:+ System.privateMemory +BALENGTH:+ ba.bytesAvailable / 4);

当我从浏览器运行此脚本时,独立调试器或AIR获得大致相同的内存用法读数(我知道有所不同)。然而,常量是字节数组的最终长度:

浏览器(Firefox):TM:540413952 FM:19116032 PM:562573312 BALENGTH:134217728



独立:TM:540577792 FM:1810432 PM:545361920 BALENGTH:134217728

AIR(2.6):TM:5410816 FM :1159168 PM:551464960 BALENGTH:134217728



我的测试方法可能并不完美,但我不知道如何进行更深入的分析。
<从Windows 7和AIR 3.3开始,Adobe AIR应用程序的内存分配限制在1GB左右。一旦Adobe AIR变成64位,这将会改变。 Adobe计划对平台进行2次不同的重写。第一次重写将在2012年底进行。该重写将为Flash,AIR运行时添加多线程。第一次重写可能不会解决现有的内存分配问题和限制。但是第二次重写肯定会在2013年发布,代号为Next。这个重写是ActionScript 4.0,其中包括64位运行时,内存分配增强,编程语言增强,新的编译器和性能的巨大改进。在此之前,不要尝试分配超过900MB的内存,应用程序的风险不会有任何警告。


I've been doing some rapid prototyping for a game I'm thinking of building. one of the main things i want to do is map generation for a tile type map. While generating the map i end up using large amounts of ram. I'm building the map as an array of random integers for my test. When i try to generate maps of a large scale flash gives me the out of memory error:

Error: Error #1000: The system is out of memory.

I've already figured i could write to a file instead, to solve that problem. but does anybody know the actual maximum size? I've tried searching around to no avail.

Activity monitor reports that ADL is using around 500MB "real memory" and around 700MB "virtual memory". The System.privateMemory property seems to match the "real memory" value.

as a side note i'm developing in OSX Snow Leopard (64) with 8gb ram

EDIT:

Here the example test i am running

var ba:ByteArray = new ByteArray();
for(var i:uint = 0; i<100000000; i++)
{
    ba.writeInt(int(Math.random()*100));
}

trace("end", ba.length, System.totalMemory);

This example runs fine, afterwards the total memory property reports around 500MB of ram used. Now increasing the target value to 400,000,000 i eventually receive the 'out of memory' error.

note: Testing in Flash CS5.5 with the timeout set to 120 seconds (the test never reaches that time)

EDIT:

i've created a better testing example:

var i:uint = 0;
var loopLength:Number = 500000000; // 500,000,000
var ba:ByteArray = new ByteArray();

for(i=0;i<loopLength;i++){
    try{ba.writeInt(1);}
    catch(e:Error){
        MEM_TI.appendText(e.message);
        break;
    }
}    

ba.position = 0;
MEM_TI.appendText("\nTM: "+System.totalMemory+" FM: "+System.freeMemory+" PM: "+System.privateMemory+" BALENGTH: "+ba.bytesAvailable/4);

When i run this script from a browser, stand-alone debugger or AIR i get roughly the same memory usage readouts (which i know vary anyway). What is constant however is the final length of the byte array:

Browser (Firefox): TM: 540413952 FM: 19116032 PM: 562573312 BALENGTH: 134217728

Stand-alone: TM: 540577792 FM: 1810432 PM: 545361920 BALENGTH: 134217728

AIR (2.6): TM: 5410816 FM: 1159168 PM: 551464960 BALENGTH: 134217728

My testing methods might not be perfect, though i dont know how to do deeper profiling.

解决方案

As of Windows 7, and AIR 3.3 Adobe AIR apps are limited to around 1GB memory allocation. This will change once Adobe AIR becomes 64-bit. Adobe plans to do 2 different rewrites of the platform. The first rewrite will take place by the end of 2012. This rewrite will add multithreading to the Flash, AIR runtimes. This first rewrite probably will not fix the existing memory allocation issues and limitations. But the second rewrite will for sure which is coming in 2013 codenamed "Next". This rewrite is the "ActionScript 4.0" which includes 64-bit runtime, memory allocation enhancements, programming language enhancements, new compiler, and a huge improvement in performance. Until then do not try to allocate more than 900MB of RAM at the risk of the app simple crashing without warning.

这篇关于Adobe AIR可以使用的最大内存量是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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