We are developing some memory intensive Adobe Air Desktop applications that sometimes peek above the 32 bit 1.3 Gb Limit in Windows and get purged by the OS. Unfortunately we can't find any options from Flex Builder to export to Windows 64 bit.
It seems from the Adobe forum that more people are interested in this feature and Adobe seems not committed yet to implemented it.
If anyone has the same issue and would like this supported please vote on the Adobe forum: https://bugbase.adobe.com/index.cfm?event=bug&id=3011846
Alternatively, any tips of dealing with memory intensive Adobe Air Desktop applications are very welcome.
AIR now has 64 bit support on Windows, from AIR 29:
https://forums.adobe.com/thread/2452737
https://labs.adobe.com/downloads/air.html
It is currently in beta, but I tried it and it seems like the memory threshold is significantly raised. Allocating 3GB+ did not cause any problems for me.
Maybe a little late, but I didn't encounter this problem whilst running in Mac :) Our app once hit the 7GB memory before the OS started swapping a lot of files.
Memory optimizations such as disposal of BitmapData, asynchrone loading of data (to allow garbage collection) and such might help you though.
ActionScript has an underlying design flaw in its memory management. This behaves differently depending on the machine. On Windows it roughly craps out at 1.25GB, while even a 32bit OS can handle more. Especially vulnerable are the Sound
, ByteArray
and FileStream
classes, but others using these in the background are effected, too.
I learned that when dealing with lots of files (FileStream
) and manipulating them (ByteArray
). The error messages thrown when the memory limit is reached are however mostly not pointing to the correct source of the error... after writing a wrapper and a custom debugger for the FileStream
class to handle all the oddities it has (try files with 0 bytes length, a favorite source of errors) I came down with 4k lines of code, but still couldn't get all cases under control.
I stumbled over these errors in almost any memory intensive AIR application I made and eventually decided to quit ActionScript. The underlying issue must be known to Adobe since at least 2009. Remember when FP9 broke the unloadSound()
method and Adobe promised to fix it in FP10? Well, they somewhat fixed it, it would now happen less often. But that's about it. They didn't fix the underlying problem entirely.
So, a 64bit version of AIR won't help you unless Adobe fixes the bugs in the underlying architecture. And the way they handled ActionScript in the last years, I wouldn't bet on them doing that.
This is the function that finally made me realize what's going on. Run it and step through the while
loop and watch what happens to the res
variable after res.length == 18
.
public static function hexToString(hex:*, len:uint = 32):String
{
if (hex == null || isNaN(hex))
{
return "UNKNOWN TYPE";
}
var str:String = '';
var strIn:String = hex.toString(16).substr(-len).toUpperCase();
var char:uint = 0x00;
var charStr:String = '';
var res:String = '';
while (strIn.length < len)
{
strIn = '0'+strIn;
}
res = strIn;
while (res.length > 1)
{
charStr = '0x'+res.substr(0, 2);
char = parseInt(charStr, 16);
res = res.substr(2);
str += String.fromCharCode(char);
}
return str;
}
I converted the function to PHP and JS to confirm and neither PHP nor JS showed erroneous behavior.
I've investigated this issue a bit recently and indeed there seems to be a memory threshold (dependent on the platform and, it seems, especially on the OS) after which an AIR app will become unresponsive / crash. I've opened an Adobe bug here: https://tracker.adobe.com/#/view/AIR-4198476. Hopefully we'll get some more info from Adobe soon.