Skip to content

File.toBytes causes Memory leak #31

@atlewee

Description

@atlewee

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions