Skip to content

Instantly share code, notes, and snippets.

@xyqfer
Created September 28, 2013 12:26
Show Gist options
  • Save xyqfer/6741574 to your computer and use it in GitHub Desktop.
Save xyqfer/6741574 to your computer and use it in GitHub Desktop.
For Memory Leaks (IE6 and IE7)
/* http://javascript.crockford.com/memory/leak.html */
function purge(d) {
var a = d.attributes, i, l, n;
if (a) {
for (i = a.length - 1; i >= 0; i -= 1) {
n = a[i].name;
if (typeof d[n] === 'function') {
d[n] = null;
}
}
}
a = d.childNodes;
if (a) {
l = a.length;
for (i = 0; i < l; i += 1) {
purge(d.childNodes[i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment