Skip to main content
Participant
Apr 9, 2012 2:56 PM UTC
Question

How do I prevent AIR privateMemory from ballooning and crashing my app?

I have a memory leak problem that keeps crashing my application; the application is programmed to display ten locally-stored swfs with embedded videos in rotation. Eventually, I get this error:

adl(2986,0xacee52c0) malloc: *** mmap(size=3584000) failed (error code=12)

*** error: can't allocate region

*** set a breakpoint in malloc_error_break to debug

A trace of freeMemory usually returns between 0 and 1 MB.

A trace of totalMemory usually returns between 30 and 102 MB.

A trace of privateMemory starts around 300 MB and crashes once it hits 1.8 GB (at least on my mac)

The swfs are loaded into the app and never unloaded - we found that running unloadAndStop() would reduce the totalMemory but cause the privateMemory to escalate extremely quickly.

Yes - we have been doing all of our best practices for memory management, event listeners are all removed, unused data and objects are nulled out.

Is there a way to get the AIR app to return privateMemory allocated to it back to the OS? The garbage collector won't do it.

Using AIR 2.7 (for use on a linux box)

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Participant
Apr 10, 2012 3:24 PM UTC

EDIT: Brilliant - after a day of testing, the memory leak has been tracked down. Some swfs loaded worked fine and never increased the privateMemory - but swfs with multiple TLFTextFields would add at least 13MB of privateMemory that could not be unloaded from the AIR app.

SWF set-up:

  • Nothing on frame 1
  • A containerMC on frame 3 containing an animation with between zero and 6 TLFTextFields
  • App loads in SWF, stops the SWF on frame one.
  • On SWF play, app moves the playhead to frame 3, playing an animation with TLFTextFields
  • On complete, app moves the playhead back to frame 1 and sets visible to false
  • Between zero and one TLFTextfield, no memory leak.
  • No memory leak when using TextFields.

Is this a documented bug? That loading in swf files using more than one TLFTextField will continually add to the memory footprint?

Translate
chris.campbell
Legend
Apr 10, 2012 8:01 PM UTC

Hi Tony,

I'm not sure if this has been reported, but I'll start searching our bug database.  In the meantime, could you please open a new bug over at bugbase.adobe.com and include any sample code/application so we can quickly and easily reproduce this bug?  Please post back with the bug URL so I can link it to our internal bug if I locate it.

Thanks,

Chris

Translate
chris.campbell
Legend
Apr 10, 2012 8:04 PM UTC

By the way, I know you mentioned this is against 2.7.  Have you had a chance to see if this also effects the released build of 3.2? 

Other than finding workarounds, we might be stuck given the current support state of AIR Linux.

Translate