Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSZip.utils.transformTo uses too much memory in Chrome #260

Open
petrcermak opened this issue Feb 25, 2016 · 5 comments
Open

JSZip.utils.transformTo uses too much memory in Chrome #260

petrcermak opened this issue Feb 25, 2016 · 5 comments

Comments

@petrcermak
Copy link

Given a Uint8Array containing 70,000,000 char codes (~67 MiB), JSZip.utils.transformTo('string', array) runs out of memory on Chrome (needs more than 1,413 MiB RAM).

This can easily be fixed by using TextDecoder instead of String.fromCharCode (if available). See catapult-project/catapult#2051 and https://codereview.chromium.org/1739663003/ for more details.

@dduponchel
Copy link
Collaborator

TextEncoder and TextDecoder were removed in #159, I'll re-add them.

@dduponchel
Copy link
Collaborator

JSZip.utils.transformTo('string', *) is not the same as TextDecoder: the first transforms an object into a binary string while the second will use the UTF8 encoding. I think you want the UTF8 version (which should use a TextDecoder if available), not the binary string one.

Also, JSZip.utils is deprecated since JSZip v2.3.0 (see #123) and JSZip.compressions will be removed is JSZip v3 (see #224).

@petrcermak
Copy link
Author

OK. Thank you for looking into this!

@dduponchel
Copy link
Collaborator

If you use only JSZip.utils and JSZip.compressions['DEFLATE'].uncompress, you may want to use pako directly (which it behind the uncompress method).

@petrcermak
Copy link
Author

Acknowledged. Thanks!

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

No branches or pull requests

2 participants