Skip to content

Conversation

falk0pr0ss
Copy link

@falk0pr0ss falk0pr0ss commented Jan 22, 2022

When adding a huge amount of files to an archive there will likely be a memory out of heap exception when writing the central file header in the zip module.

Here is a small test for reproduction where testfile can be an empty file:
<script src="https://gist.github.com/falk0pr0ss/d92f77c342f2505b40faed42946f73b4.js"></script>

Here is the behaviour before the proposed fix - the huge increase of memory usage is when the writeCentralFileHeader method is called repeatedly and a memory out of heap exception is caused:

Screenshot 2022-01-22 105016

Here is the behaviour with the proposed fix, where the risk of a memory out of heap exception is reduced by waiting for the drain event to be fired after the write method returns false:

Screenshot 2022-01-21 093548

@stixx200
Copy link

stixx200 commented Nov 4, 2022

@ctalkington
Any updates here? I also need this fix :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants