Jump to content

User:Mdaniels5757/chromeAutoGarbageCollect.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/**
 * @file This script just runs Chrome's garbage collector periodically.
 * (every wait_ms milliseconds (where wait_ms > 60000), to be exact).
 * Made because there's some sort of memory leak in one script/gadget or another
 * and I can't be bothered to figure out which.
 * The relevant Chrome flag must be enabled for this to work.
 * 
 * @copyright Copyright 2020 Michael Daniels (Wikipedia User:Mdaniels5757)
 * @license Your choice of CC-BY-SA-3.0 (https://creativecommons.org/licenses/by-sa/3.0/legalcode) and Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
 */ 

var wait_ms = 61000;

function runGC() {
	window.gc();
	
	setTimeout( function () {
		runGC();
	}, wait_ms);
}

runGC();