New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 817282 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows
Pri: 2
Type: Bug



Sign in to add a comment

Memory Leak of FileReader readAsArrayBuffer

Reported by baptiste...@imascap.com, Feb 28 2018

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36

Steps to reproduce the problem:
Bug on Google Chrome
https://jsfiddle.net/0b0jzssr/30/
1. Use the input to choose a folder containing large file
2. Wait 10s
3. The memory should be freed but it's not

What is the expected behavior?
After 10s the memory should be freed
It works as expected on FireFox and Chromium

What went wrong?
The memory stay allocated, you have to close the tab to free the memory

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 64.0.3282.186  Channel: stable
OS Version: Mint 18.2 MATE 64-bit
Flash Version: 

I noticed the bug on Google Chrome so I'm not sur this is the place to report, sorry if it's not
 
Labels: Needs-Triage-M64
Cc: sindhu.chelamcherla@chromium.org
Labels: Triaged-ET Needs-Feedback
Unable to reproduce this issue on reported version 64.0.3282.186 using Ubuntu 14.04 with steps mentioned below.

1. Opened https://jsfiddle.net/0b0jzssr/30/ , opened task manager and observed memory footprint of this tab.
2. Uploaded file and observed increase in memory usage.
3. After sometime memory of that tab becomes normal in task manager.

@Reporter: Please check the video and let us know if we miss anything. Also please check the issue on fresh profile which do not have any apps/extensions. This info would help in further triaging of the issue.

Thanks!
817282.ogv
7.2 MB View Download

Comment 3 by woxxom@gmail.com, Mar 2 2018

sindhu.chelamcherla@ you need to choose a folder that contains large files (not in sub-folders) with a total size of 100-500MB for easier assessment.

FWIW in Windows I can reproduce with old Chrome/Chromium (51-60).
Bisected to r380607 (breakage) with a fix in 502c6ae6a03979efbd3e006e6a0b8c3369ca2bbc.
However, I didn't test in Linux so this may be a different regression.

Comment 4 Deleted

I don't know why you can't reproduce, I think we are doing the same thing.
out-7.ogv
3.0 MB View Download
Project Member

Comment 6 by sheriffbot@chromium.org, Mar 2 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
https://jsfiddle.net/0b0jzssr/38/ -> JSFiddle with comment

Here is the expected comportement on Chromium

out-2.ogv
3.1 MB View Download
Labels: M-67 Target-67 FoundIn-67 OS-Windows
Status: Untriaged (was: Unconfirmed)
As per comment #3, the issue seems to exist from M-60. Hence, marking it as untriaged for further inputs from dev team.

Thanks...!!
Cc: mek@chromium.org dmu...@chromium.org
I'm not sure if this is WAI or not - the garbage collector doesn't necessarily remove stuff. We tell V8 about external blob memory I believe.

See here:
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp?dr=CSs&l=342

AdjustReportedMemoryUsageToV8

+mek
*the garbage collector doesn't necessarily remove stuff right away*

Does your system have a lot of memory?
Status: Available (was: Untriaged)
After a chat with mek@, it seems like the FileReaderLoader is holding a reference to the ArrayBuffer, but Oilpan has no way of accessing / accounting for that object. We don't count it as 'external' memory either. Not sure the best way to solve this, but I think we've confirmed this as an issue.

Comment 12 by mek@chromium.org, Mar 5 2018

possible ways of solving this:
- make FileReaderLoader garbage collected (and change every place that owns one from std::unique_ptr to Member, and add tracing etc).

- make FileReaderLoader DISALLOW_NEW, and change every place that owns one to just directly hold one rather than having a pointer. Only non-straightforward case I think would be IDBRequestLoader, where we'd then have to wrap the FileReaderLoader in something else. Every other usage I can find lifetime of the FileReaderLoader already seems to match lifetime of its owner.

- Refactor FileReaderLoader to not actually hold on to any memory past the load operation. Instead just transfer ownership of the resulting data to the client in DidFinishLoading.

- Probable other options exist as well...
Components: Blink>Storage>FileAPI
Components: -Blink>FileAPI

Sign in to add a comment