|
I gather that if you declare a variable in JavaScript, then later set its value to null, that memory becomes subject to garbage collection. But one trap I seemed to fall into pertained to storing references to DOM objects in JavaScript arrays, and setting the array length to 0, but not explicitly destroying the DOM elements referenced from array elements. That seemed to cause a memory leak.Garbage collection can only collect those objects which are not referenced from _anywhere_. By having references in arrays or in event handlers, this requirement is not fulfilled so they keep hanging around.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.