Skip to content

Instantly share code, notes, and snippets.

@damienwebdev
Created July 24, 2022 17:54
Show Gist options
  • Save damienwebdev/7f9f1694f3369cc14e16ef88173bed94 to your computer and use it in GitHub Desktop.
Save damienwebdev/7f9f1694f3369cc14e16ef88173bed94 to your computer and use it in GitHub Desktop.
Showcases memory leaks on page changes.
const PAGE_1 = document.querySelector('YOUR_SELECTOR');
const PAGE_2 = document.querySelector('YOUR_OTHER_SELECTOR');
let count = 0;
const memleakInterval = setInterval(() => {
count % 2 === 0 ? PAGE_1.click() : PAGE_2.click();
count++;
console.log(count);
}, 1000);
//clearInterval(memleakInterval);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment