Okay, so we're making an AIR 2.7 App that runs on Linux. It swaps out child swf files all the time, the same five files, all loaded into the app once and playing in sequence.
Running on a Mac, the privateMemory continually reads around 400MB, give or take. Linux... Linux is weird.
Linux will start at about 200MB, and balloon. If we're lucky, Linux will decide to reclaim some memory, and we'll go back down to 200MB. If we're not lucky, we'll escalate past 2100MB at which point the app will crash (even though the box has 4GB of RAM).
I understand that System.privateMemory and System.gc() (both called regularly) is highly dependant on the OS, that's fine. But all methods of freeing up memory on Linux have failed, including cron jobs running methods outlined here: http://www.linuxarticles.org/2010/10/release-memory-in-linux-unused-or -cached/
To be clear: there is no memory leak. We cannot reproduce the problems we are experiencing in Linux with any other setup. And Linux can decide to run for days, releasing memory, reseting to around 200MB.
Is there any way to...
Not sure what could be going on here. I'll forward this to the team that used to work on Linux to see if they have any ideas. You might also want to create a new bug on this at bugbase.adobe.com. If possible, please attach your application so we can reproduce the problem. If you'd like to keep this private, please feel free to email it to me directly at firstname.lastname@example.org.
I did more research, and the Linux approach to RAM handling can be summed up with, "unused RAM is being wasted". Linux seeks to fill the RAM with data that might be reused, clearing it when something else needs it.
Since AIR seems to want to run out of memory well before Linux thinks AIR is out of memory, Linux never gets a chance to fill the RAM before it crashes.
Is there a maximum memory footprint on AIR apps? That should be determined by the OS, right?
We tested this on a less powerful Linux box with only 2GB of RAM (compared to 4GB of RAM in our good Linux boxes). It works fine.
In the stupidest fix I've ever seen, we are now theorizing that if we either physically remove or disable all but 2 GB of RAM, Linux will be forced to swap memory more often, thereby avoiding the issue that AIR 2.7 seems to have, where it crashes itself if it begins using more than 2GB of memory.
Is this behaviour expected in AIR or a bug? Is it a failsafe or an unexpected behavior?
Logging a bug: https://bugbase.adobe.com/index.cfm?event=bug&id=3192706 (Upvote if you've encountered this as well)
Last update: all attempts to solve this have failed. I now have a linux application (Sentinella) running that tracks memory usage and reboots the system when a crash is expected.
Ultimately, at some point AIR cannot handle having more than 2 GB of memory for itself (the breakpoint seems to be around 2200 MB) and will crash. But it's the OS's job to handle memory, which Linux only does rarely compared to OS X or Windows.