On Wed, Jul 4, 2012 at 11:54 PM, Roland Zwaga <[email protected]>wrote:
> >
> > Since we are unzipping the files in actionscript, ADL's memory footprint
> is
> > ballooning up to more than 1+ GB. This is causing the unzipping to crash
> > with a "Error #1000: The system is out of memory." error.
> >
> > Even though my computer has 8 Gigs of RAM, ADL has an limit of around 1GB
> > per app. So, this is expected behavior.
> >
> > I really wish we dint have to download the Adobe Flex 4.6 zip file at
> all.
> > The other option is to ship 7-Zip along with the app and use it instead
> of
> > FZip. I am not sure if memory used by a NativeProcess counts towards the
> > ADL memory limit.
> >
> > Any other ideas?
> >
>
> Hey Om,
>
> I just had a quick look at the code and I see that for each call to: var
> fzip:Zip = new Zip();
> and subsequently adding event listeners, there isn't any clean up done.
> Clean up, as in an explicit call to fzip.close() and removal of *all* event
> listeners (there's 3 added and only 2 removed).
> I'm guessing adding this to the code will make sure that a Zip instance
> will be properly garbage collected
> after its used, thus keeping the memory from ballooning.
>
> So this method should at the very least look like this:
>
> private function onUnzipComplete(event:Event):void
> {
> var fzip:Zip = event.target as Zip;
> * fzip.close();*
> fzip.removeEventListener(ZipEvent.FILE_LOADED, onFileLoaded);
> fzip.removeEventListener(Event.COMPLETE, onUnzipComplete);
> }
>
> The dynamic Event.COMPLETE listener (unzipCompleteFunction) might be added
> as a weak listener I guess.
>
> cheers,
>
> Roland
>
Yup, my bad. Pretty big memory leaks because I am not cleaning things up
properly . I have added a few checks since, but I will add your
suggestions as well. Thanks for catching that.
BTW, I am sure there are other similar issues with the codebase, it would
do good to the codebase if it gets more eyballs :-)
Thanks,
Om