zip icon indicating copy to clipboard operation
zip copied to clipboard

Excess memory usage

Open tfc opened this issue 2 years ago • 1 comments

Hi there,

[edit: i reduced the app and added some heap profile graphs]

i wrote a little example programm (see my branch to try it out: https://github.com/tfc/zip)

import Codec.Archive.Zip

main :: IO ()
main = withArchive "archive.zip" $ unpackInto "output_dir"

archive.zip is just a ~40MB nixpkgs zip-ball (see my repo link: test.sh downloads this file for anyone who wants to try it at home).

different profiles:

unziptest-hc

unziptest-hd

unziptest-hm

unziptest-hr

unziptest-hy

so the library consumes ~200 mb ram for unpacking a 40mb zip archive and i think this should be less, right? From looking at the different profiles, it seems that the String type of the zip entries blows up quite a bit, might that be?

tfc avatar Sep 30 '21 17:09 tfc

Hi, thanks for the report. I will look at this eventually, but I can't promise anything in the coming 2 weeks. If you figure it out yourself please feel free to comment here and/or open a PR.

mrkkrp avatar Oct 01 '21 15:10 mrkkrp