Following are examples of running js_objgc.d.
This script reports on the garbage collection of Java objects. That is it
will keep track of when resources are allocated to an object, and when
resources are freed from an object. It is useful for providing information on
when garbage collection is not working correctly, as this can cause the
browser to have a memory leak.
We trace object creation (+1) and destruction (-1), and provide a summary
each second of the running tally of the object class and originating filename.
Here we can see it running on Code/JavaScript/func_clock.html
# js_objgc.d
Tracing... Hit Ctrl-C to end.
FILE TOTAL CLASS 2007 Sep 23 22:59:24
func_clock.html 1 Date
FILE TOTAL CLASS 2007 Sep 23 22:59:25
func_clock.html 2 Date
FILE TOTAL CLASS 2007 Sep 23 22:59:26
func_clock.html 3 Date
FILE TOTAL CLASS 2007 Sep 23 22:59:27
func_clock.html 4 Date
FILE TOTAL CLASS 2007 Sep 23 22:59:28
func_clock.html 5 Date
FILE TOTAL CLASS 2007 Sep 23 22:59:29
browser.js 3 Function
<null> 5 Function
func_clock.html 6 Date
<null> 7 MouseEvent
FILE TOTAL CLASS 2007 Sep 23 22:59:30
browser.js 3 Function
<null> 5 Function
func_clock.html 7 Date
<null> 10 MouseEvent
FILE TOTAL CLASS 2007 Sep 23 22:59:31
<null> 1 Constructor
<null> 1 HTMLBodyElement
<null> 1 XPCNativeWrapper
<null> 1 XPC_WN_ModsAllowed_Proto_JSClass
browser.js 1 Array
browser.js 1 XPCNativeWrapper
popup.xml 1 Array
func_clock.html 7 Date
<null> 13 MouseEvent
<null> 18 Function
browser.js 20 Function
FILE TOTAL CLASS 2007 Sep 23 22:59:32
<null> 1 BoxObject
<null> 1 Constructor
<null> 1 HTMLBodyElement
<null> 1 NodeList
<null> 1 UIEvent
<null> 1 XPCNativeWrapper
<null> 1 XPC_WN_ModsAllowed_Proto_JSClass
<null> 1 chrome://global/content/bindings/menu.xml#menu-iconic 84ff45a
<null> 1 chrome://global/content/bindings/menu.xml#menu-iconic 8befbba
bookmarksMenu.js 1 Function
browser.js 1 Array
browser.js 1 XPCNativeWrapper
popup.xml 1 Function
scrollbox.xml 1 Function
<null> 2 Event
popup.xml 2 Array
bookmarks.js 3 With
firebug-service.js 3 Object
bookmarks.js 6 Object
bookmarks.js 6 XPCWrappedNative_NoHelper
func_clock.html 8 Date
firebug-service.js 10 Function
<null> 15 MouseEvent
bookmarks.js 19 Error
browser.js 20 Function
bookmarks.js 22 Function
<null> 39 XPCWrappedNative_NoHelper
<null> 44 Function
<null> 60 RegExp
<null> 191 XULElement
[... 39 seconds deleted ...]
FILE TOTAL CLASS 2007 Sep 23 23:00:10
<null> 1 HTMLBodyElement
<null> 1 HTMLCollection
<null> 1 TreeColumns
<null> 1 XPCNativeWrapper
<null> 1 XPC_WN_NoMods_Proto_JSClass
<null> 1 XULTreeBuilder
<null> 1 chrome://global/content/bindings/menu.xml#menu-iconic 84ff45a
<null> 1 chrome://global/content/bindings/menu.xml#menu-iconic 8befbba
<null> 1 chrome://global/content/bindings/tree.xml#treebody 84caa3a
<null> 1 chrome://global/content/bindings/tree.xml#treebody 84e3a72
<null> 1 nsXPCComponents_Interfaces
<null> 1 nsXPCComponents_Results
bookmarksMenu.js 1 Function
browser.js 1 Array
browser.js 1 XPCNativeWrapper
browser.js 1 XPC_WN_NoMods_Proto_JSClass
nsUpdateService.js 1 XPC_WN_NoMods_Proto_JSClass
nsUpdateService.js 1 nsJSCID
popup.xml 1 Function
scrollbar.xml 1 String
scrollbox.xml 1 Function
tree.xml 1 Array
<null> 2 Constructor
<null> 2 UIEvent
<null> 2 XPC_WN_ModsAllowed_Proto_JSClass
<null> 2 nsXPCComponents_Classes
browser.js 2 nsJSCID
browser.js 2 nsJSIID
utilityOverlay.js 2 nsJSCID
utilityOverlay.js 2 nsJSIID
<null> 3 Array
<null> 3 NodeList
nsUpdateService.js 3 Array
nsUpdateService.js 3 Object
nsUpdateService.js 3 With
utilityOverlay.js 3 Call
tree.xml 4 Function
utilityOverlay.js 4 Function
nsUpdateService.js 7 nsJSIID
nsUpdateService.js 15 Function
bookmarks.js 22 Function
text.xml 23 String
<null> 36 BoxObject
func_clock.html 42 Date
bookmarks.js 57 With
firebug-service.js 57 Object
bookmarks.js 73 Error
browser.js 78 Function
popup.xml 82 Array
bookmarks.js 114 Object
bookmarks.js 114 XPCWrappedNative_NoHelper
<null> 157 MouseEvent
firebug-service.js 172 Function
<null> 307 XPCWrappedNative_NoHelper
<null> 388 RegExp
<null> 488 Event
<null> 876 XULElement
<null> 1221 Function
FILE TOTAL CLASS 2007 Sep 23 23:00:11
<missed> -94 Date
<missed> -34 Function
<missed> -4 MouseEvent
<missed> -2 Array
<missed> -1 HTMLBodyElement
<missed> -1 HTMLCollection
<missed> -1 XPCNativeWrapper
<missed> -1 XPC_WN_ModsAllowed_Proto_JSClass
<null> 0 Array
<null> 0 HTMLBodyElement
<null> 0 HTMLCollection
<null> 0 RegExp
<null> 0 TreeColumns
<null> 0 UIEvent
<null> 0 XPC_WN_NoMods_Proto_JSClass
<null> 0 XULTreeBuilder
<null> 0 nsXPCComponents_Classes
<null> 0 nsXPCComponents_Interfaces
<null> 0 nsXPCComponents_Results
browser.js 0 Array
browser.js 0 XPCNativeWrapper
browser.js 0 XPC_WN_NoMods_Proto_JSClass
browser.js 0 nsJSCID
nsUpdateService.js 0 Array
nsUpdateService.js 0 Function
nsUpdateService.js 0 Object
nsUpdateService.js 0 With
nsUpdateService.js 0 XPC_WN_NoMods_Proto_JSClass
nsUpdateService.js 0 nsJSCID
nsUpdateService.js 0 nsJSIID
scrollbar.xml 0 String
text.xml 0 String
tree.xml 0 Array
utilityOverlay.js 0 Call
utilityOverlay.js 0 Function
utilityOverlay.js 0 nsJSCID
<null> 1 NodeList
<null> 1 XPCNativeWrapper
<null> 1 chrome://global/content/bindings/menu.xml#menu-iconic 84ff45a
<null> 1 chrome://global/content/bindings/menu.xml#menu-iconic 8befbba
<null> 1 chrome://global/content/bindings/tree.xml#treebody 84caa3a
<null> 1 chrome://global/content/bindings/tree.xml#treebody 84e3a72
bookmarksMenu.js 1 Function
browser.xul 1 Function
func_clock.html 1 Date
popup.xml 1 Function
scrollbox.xml 1 XULElement
scrollbox.xml 1 nsJSIID
<null> 2 Constructor
<null> 2 XPC_WN_ModsAllowed_Proto_JSClass
browser.js 2 nsJSIID
scrollbox.xml 2 Function
tree.xml 2 Function
utilityOverlay.js 2 nsJSIID
popup.xml 3 Array
bookmarks.js 5 With
firebug-service.js 5 Object
<null> 6 Event
<null> 6 MouseEvent
bookmarks.js 9 XPCWrappedNative_NoHelper
<null> 10 XPCWrappedNative_NoHelper
bookmarks.js 10 Object
browser.js 10 Function
bookmarks.js 15 Function
firebug-service.js 16 Function
<null> 18 BoxObject
bookmarks.js 75 Error
<null> 79 Function
<null> 315 XULElement
^C
Just after time 23:00:10, garbage collection fired cleaning up many objects.
The final output shows a much reduced object count including a negative
count for objects created before this script was tracing.
If over the period of several minutes an object type is still steadily
increasing, then that would be of interest. Be patient, depending on the rate
of object creation it can take over ten minutes for garbage collect to kick in.