Skip to content

Running out of memory extracting archives with large files embedded #27

@brendand

Description

@brendand

Different from the 64 bit issue, this time my iOS app aborts when I attempt to unzip an archive that contains a file that expands to 1.4 GB. The zipped archive itself is 775 MB, but unzips much larger. There are other files in the archive, but the main file is this big 1.4 GB file.

The issue is in the extractFilesTo:overwrite:progress:error method. It reads the entire file from the archive into memory and then writes it out. Specifically right off the bat, the readFile:length:error method allocates an NSMutableData object that's as big as the file. Boom on iOS!

Instead, I would recommend using your own extractBufferedData:fromFile:error:action method to unzip all the files in an archive. That way you improve memory usage considerably and then it doesn't matter how big any individual file is.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions