Skip to content

Instantly share code, notes, and snippets.

@martinwells
Created June 21, 2012 19:32
Show Gist options
  • Save martinwells/2967986 to your computer and use it in GitHub Desktop.
Save martinwells/2967986 to your computer and use it in GitHub Desktop.
var lastUsedHeap = 0; // remember the heap size
function checkMemory()
{
// check if the heap size is this cycle is LESS than what we had last
// cycle; if so, then the garbage collector has kicked in
if (window.performance.memory.usedJSHeapSize < lastUsedHeap)
console.log('Garbage collected!');
lastUsedHeap = window.performance.memory.usedJSHeapSize;
}
setTimeout(checkMemory, 100); // test 10 times per second
do shell script
"\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"
--enable-memory-info"
chrome --enable-memory-info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment