Yesterday I reported a Gecko bug where reproducing required the garbage collector to run. In the following discussion this useful snippet of code appeared:
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIDOMWindowUtils) .garbageCollect();
So if you are suspecting that some issue you are observing is dependent on the garbage collector you can use this to force garbage collector to run. I shared that code at work and promptly got a question: what’s the difference to Components.utils.forceGC()? There we go, yesterday I didn’t even know that there was a way to force garbage collection, and today I already know two!
As to the difference, existing documentation is remarkably reluctant to tell us. I confirmed my guess by looking at the code: