theme selector

light blue screenshot grey screenshot navy screenshot dark green screenshot red and black screenshot
 

by Tony Chang
tony@ponderer.org

All opinions on this site are my own and do not represent those of my employer.

Creative Commons Attribution License

DocumentLeak:5

Sep 22, 2006, 03:15am EDT

 

 

A simple way to check to see if your javascript (or greasemonkey script) is accidentally holding on to the document (and thus, leaking huge gobs of memory):

NSPR_LOG_MODULES=DocumentLeak:5 /path/to/firefox

This generates a trace of each document creation and destruction like so:

-1221376320[8a4ceb0]: DOCUMENT 9352bf8 created
-1221376320[8a4ceb0]: DOCUMENT 9352bf8 StartDocumentLoad chrome://browser/content/browser.xul
-1221376320[8a4ceb0]: DOCUMENT 93a48a0 created
-1221376320[8a4ceb0]: DOCUMENT 93a48a0 StartDocumentLoad http://www.google.com/firefox?client=firefox-a&rls=org.mozilla:en-US:official
-1221376320[8a4ceb0]: DOCUMENT 93a48a0 ResetToURI http://www.google.com/firefox?client=firefox-a&rls=org.mozilla:en-US:official
-1221376320[8a4ceb0]: DOCUMENT 9417770 created
-1221376320[8a4ceb0]: DOCUMENT 9417770 StartDocumentLoad http://en-us.fxfeeds.mozilla.com/en-US/firefox/headlines.xml
-1221376320[8a4ceb0]: DOCUMENT 9417770 destroyed
-1221376320[8a4ceb0]: DOCUMENT 912cf00 destroyed

The only catch is that “destroyed” isn’t triggered immediately due to the bfcache. Reloading the page or closing a tab will trigger the document destructor much faster than navigating to a new page.