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

File.toBytes causes Memory leak #31

Open
atlewee opened this issue May 13, 2022 · 0 comments
Open

File.toBytes causes Memory leak #31

atlewee opened this issue May 13, 2022 · 0 comments

Comments

@atlewee
Copy link

atlewee commented May 13, 2022

Every time you run File.toBytes, all of those bytes stays in memory forever. Even if never used.
Running this function on a 350MB file a couple of times will make the browser use gigabytes of RAM.
Chrome_before

File.toString and File.toUrl does not have the same problem, those are garbage collected immidiatly
( I have tested Chrome and Firefox on Linux and get exactly the same results )
Firefox_toString

Possible solution:
image

Adding reader = null after it is used removes the problem on both Chrome and Firefox, with this line added I see no memory leak anymore.

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

1 participant