out of memory error when I have plenty of memory available
I'm working on a fairly large AIR desktop/kiosk app that consistently crashes, usually with an out of memory error first (that error message doesn't appear when I'm profiling). What's confusing about this is that I have plenty of RAM available (16GB total, only 50-60% in use) and the AIR app itself crashes between 1GB - 1.2GB of memory use. With projector files I can reliably use up to about 1.7GB but I needed AIR for this project. I have managed to work around the error by loading/unloading modules, but this is not ideal since the app freezes while modules are loaded/unloaded. It's not a deal breaker but we prefer to avoid any pauses if we can.
Aside from the fact that it seems to be prematurely running out of memory, another thing that is perplexing is the fact that the app uses more RAM while initializing than when it crashes, and during normal use the memory graph in the profiler remains almost completely flat and safely below the peak memory used during initialization. The only objects that are created/destroyed at this point are some events and a generic object used for storing metrics/user data that is saved/loaded as JSON. A typical session file is less than 2kb on disk and is destroyed when the user logs out, so I don't think this is creating a memory leak, and the flat memory graph confirms this. As the users interact with the kiosk you can see the memory use in the task manager increase, so obviously something is taking up more memory but it doesn't appear to be anything in my code.
The project uses Stage3d with Flare3d, but I did a build using no Stage3d and the error persists. I also tried using cpu mode instead of direct or gpu to rule out some issue with the video card but that also had no effect on the crashing.
So what causes an AIR app to run out of memory with so much free memory available, and how does an app run out of memory when its current memory use is less than the peak memory? If anyone from Adobe would like to view the final deliverable (~474MB) or take a look at the source files (~579MB) I'd be happy to share it.
The app is compiled using Flex SDK 4.5.1 with AIR SDK 3.1, using captive runtime on Windows 7 for final deliverable.
