liuyong/ziparchive

Memory footprint issues when unzipping large archives

Opened this issue · 3 comments

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

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

  • Changed state: Started
  • Added labels: Priority-High
  • Removed labels: Priority-Medium
Issue 10 has been merged into this issue.

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

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