Skip to content

compress/flate, archive/zip: large memory allocations reading flate zip archive with many files #59774

Description

@subtle-byte

What version of Go are you using (go version)?

$ go version
go version go1.20.3 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do? What did you see instead?

I noticed large memory allocations reading a flate-endoded zip archive with many files. Looks like opening each file 4KB buffer is allocated (if I read the files sequentially it is not needed - GC does a lot of work). So if I open a zip archive with 50000 files the memory allocations will be about 200 MB in sum just for the buffers.

See the test in the prepared PR for a code example.

What did you expect to see?

Less memory allocations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions