Export to GitHub

ziparchive - issue #18

Memory footprint issues when unzipping large archives


Posted on Feb 14, 2011 by Helpful Bird

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 );

Comment #1

Posted on Feb 15, 2011 by Happy Wombat

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~

Comment #2

Posted on Feb 15, 2011 by Happy Wombat

Issue 10 has been merged into this issue.

Comment #3

Posted on Feb 28, 2011 by Swift Elephant

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!

Status: Started

Labels:
Type-Defect Priority-High