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

Issue 805655 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Growing memory from opening images in DOM and removing them

Reported by alecper...@gmail.com, Jan 24 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36

Steps to reproduce the problem:
Steps to reproduce the problem:

Follow up to  issue 625168 : https://bugs.chromium.org/p/chromium/issues/detail?id=625168

It was once reported ( Issue 625168 ) that Chrome holds on to displayed images in memory even after the image has been removed from the DOM. Following pseudo code APPARENTLY demonstrated the problem

for (let i = 0; i < 100000; ++i) {
  let e = document.createElement('img')
  e.src = 'file:///tmp/1161kb.png'
  document.body.appendChild(e)
  setTimeout(() => { document.body.removeChild(e) }, 1000)
}

Did this work before? N/A 

What is the expected behavior?
Once an image is taken out of the DOM, its resources are freed.

What went wrong?

APPARENTLY Memory would grows until you get an out of memory crash.

Did this work before? N/A 

Chrome version: 64.0.3282.119  Channel: stable
OS Version: 10.0
Flash Version: 

See: https://i.imgur.com/P3ZwlCS.gifv

Chromium apps like VS Code currently refuse to allow preview of images/files >1mb (without allowing user to configure this limit) They reference  issue 625168 , so I made this one since I like to preview large files in VS Code. 

I was able to loop ~10000 times before it crashed, which may just have been due to scrolling the console. I've got good pc specs: https://i.imgur.com/ghtNjgT.png but even with mediocre cpu/ram very rarely would this cause a crash if ever, probably.
 
my-pc-specs.png
118 KB View Download
loading-10000-1mb-images-no-problem.gifv
6.8 KB Download
Labels: Needs-Bisect Needs-Triage-M64
Cc: susanjun...@techmahindra.com
Labels: Triaged-ET Needs-Feedback
alecperkey@ Thanks for the issue.

Tested this issue on Windows 10 and Mac OS 10.12.6 on the latest Stable 64.0.3282.119 and Canary 66.0.3330.0 by following the below steps.

1. Launched Chrome and navigated to Devtools -> Console.
2. Pasted the given code in console and executed it.
3. Opened Task Manager and monitored it.
4. Once the code got executed , could see the message on Console '100000 Not allowed to load local resource:file:///tmp/1161kb.png' and cannot see any crash on Chrome.
Attached is the screen shot for reference.

Can you please check and confirm if anything is missed from our end in reproducing the issue.

Also attached is the system information on which the issue was checked.

Request you to kindly retry the issue on a new chrome profile and if there are any crashes, please update the thread with the Crash ID from chrome://crashes, which will help in further triaging of this issue.

Thanks..


805655.png
166 KB View Download
system info.png
38.8 KB View Download
For windows you must find the Chrome.exe
Mine was in "C:\Program Files (x86)\Google\Chrome\Application"

But it could be in APPDATA iirc

Then you right click, create shortcut, and add to the shortcut tab: 
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Default" --allow-file-access-from-files

The --allow-file-access-from-files is the important part since local files should usually not be accessible by Javascript programs (Security hole).

the --profile-directory="Default" is unnecessary for you, but I have multiple profiles so multiple chrome shortcuts depending on which Google Acc I'm using.

https://i.imgur.com/DlZcwDZ.png

as for iOS, try this search: "--allow-file-access-from-files" +ios +chrome

2 crash reports yesterday:

https://bugs.chromium.org/p/chromium/issues/detail?id=806099
https://bugs.chromium.org/p/chromium/issues/detail?id=806100
also you need to actually have the file located at the referenced place in the script: https://i.imgur.com/6ZsZvhm.png
Project Member

Comment 5 by sheriffbot@chromium.org, Jan 25 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "susanjunia.boorgula@techmahindra.com" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: TE-NeedsTriageFromHYD
alecperkey@ Thanks for the feedback.

Tested this issue again on Windows 10 on the latest Stable 64.0.3282.119 and Canary 66.0.3334.0 and unable to reproduce the issue by following the below steps.

1. Launched Chrome with the flag --allow-file-access-from-files.
2. Navigated to Devtools -> Console, pasted the given code in console and executed it.
3. Monitored the task manager and could not observe any spike in memory usage. Didn't observe any crash on chrome as well and could see the message on Console '100000 Not allowed to load local resource:file:///tmp/1161kb.png'.

As per comment #3, as 2 crash issues are raised for this issue, requesting someone from Inhouse team to please look into this issue and help in further triaging.

Thanks..


Status: WontFix (was: Unconfirmed)
The snippet implies that for a second all these images are kept in memory. You are not using http, so connection is not throttled, so you could end up loading image 1000 times.

Sign in to add a comment