Is assigning a null
value to a variable containing a memory reference for an object considered a memory leak?
var x = { a : 10 };
x = null;
My understanding is that after setting x
to null
, the original memory reference will still hold its value, potentially causing a memory leak. Can anyone confirm if this assumption is accurate and explain how the JavaScript garbage collector deals with situations like this to prevent memory leaks? Links to relevant explanations would be appreciated.