yeweiyang / ziparchive

Automatically exported from code.google.com/p/ziparchive
0 stars 0 forks source link

Memory footprint issues when unzipping large archives #18

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When unzipping large archives, the footprint of -[ZipArchive 
UnzipFileTo:overwrite:] can become very large, because there are autoreleased 
objects created for each individual file during the unzip.  These don't get 
released until after the call returns, when the autorelease pool is next 
drained.

To fix the problem, add another pool inside the do{}while in -[ZipArchive 
UnzipFileTo:overwrite:] :

    do{
        NSAutoreleasePool *internalPool = [[NSAutoreleasePool alloc] init];

        if( [_password length]==0 )
...
        ret = unzGoToNextFile( _unzFile );

        [internalPool drain];
    }while( ret==UNZ_OK && UNZ_OK!=UNZ_END_OF_LIST_OF_FILE );

Original issue reported on code.google.com by ja...@th.ingsmadeoutofotherthin.gs on 14 Feb 2011 at 3:40

GoogleCodeExporter commented 8 years ago
Yes! I encountered this problem myself and joined the project to add a fix for 
this, among other things.  Thank you for submitting this issue~

Original comment by elinc...@hachisoft.com on 15 Feb 2011 at 7:41

GoogleCodeExporter commented 8 years ago
Issue 10 has been merged into this issue.

Original comment by elinc...@hachisoft.com on 15 Feb 2011 at 8:13

GoogleCodeExporter commented 8 years ago
Has this fix been rolled into the source? If not, any chance I can get this 
fix? We are running into this ourselves and this fix would help us greatly.

Thanks!

Original comment by grum...@gmail.com on 28 Feb 2011 at 12:37