0

I am debugging memory-issues in an angular app, and have this memory snapshot in Firefox

enter image description here

I have then tried deleting all the images using this in the console

document.querySelector("img").remove();

(I ran that multiple times until it failed bacause all images were deleted. All visible images disappered from view)

However the memory snapshot still shows the same amount of memory used for IMG.

Is there some virtual DOM that I missed since the memory is not freed?

Is it just something that will be Garbage-Collected later?

What other methods exist to identify the elements taking up memory?

FelixHJ
  • 1,071
  • 3
  • 12
  • 26
  • 1
    "Is it just something that will be Garbage-Collected later?" - Yes – E-telier Dec 08 '21 at 12:48
  • Ok, so it is part not part of the DOM as such, but the memory was there at some point (I am new to that part of the developer console) – FelixHJ Dec 08 '21 at 12:59
  • The Objects are not part of the DOM anymore, but they still exist in the computer RAM until the garbage collector does its work (**IF** they are not stored in some other variable of course). – E-telier Dec 08 '21 at 13:07
  • Is there a way to force a GC run to see what the state of the IMG elements are? – FelixHJ Dec 08 '21 at 13:12
  • 1
    None that I know of... But apparently there is a way in IE and Opera, see https://stackoverflow.com/questions/8032928/can-i-trigger-javascripts-garbage-collection – E-telier Dec 08 '21 at 13:25

0 Answers0