1Following are examples of running js_objgc.d.
2
3This script reports on the garbage collection of Java objects.  That is it
4will keep track of when resources are allocated to an object, and when
5resources are freed from an object.  It is useful for providing information on
6when garbage collection is not working correctly, as this can cause the
7browser to have a memory leak.
8
9We trace object creation (+1) and destruction (-1), and provide a summary
10each second of the running tally of the object class and originating filename.
11
12Here we can see it running on Code/JavaScript/func_clock.html
13
14# js_objgc.d
15Tracing... Hit Ctrl-C to end.
16
17 FILE                        TOTAL CLASS                   2007 Sep 23 22:59:24
18 func_clock.html                 1 Date
19
20 FILE                        TOTAL CLASS                   2007 Sep 23 22:59:25
21 func_clock.html                 2 Date
22
23 FILE                        TOTAL CLASS                   2007 Sep 23 22:59:26
24 func_clock.html                 3 Date
25
26 FILE                        TOTAL CLASS                   2007 Sep 23 22:59:27
27 func_clock.html                 4 Date
28
29 FILE                        TOTAL CLASS                   2007 Sep 23 22:59:28
30 func_clock.html                 5 Date
31
32 FILE                        TOTAL CLASS                   2007 Sep 23 22:59:29
33 browser.js                      3 Function
34 <null>                          5 Function
35 func_clock.html                 6 Date
36 <null>                          7 MouseEvent
37
38 FILE                        TOTAL CLASS                   2007 Sep 23 22:59:30
39 browser.js                      3 Function
40 <null>                          5 Function
41 func_clock.html                 7 Date
42 <null>                         10 MouseEvent
43
44 FILE                        TOTAL CLASS                   2007 Sep 23 22:59:31
45 <null>                          1 Constructor
46 <null>                          1 HTMLBodyElement
47 <null>                          1 XPCNativeWrapper
48 <null>                          1 XPC_WN_ModsAllowed_Proto_JSClass
49 browser.js                      1 Array
50 browser.js                      1 XPCNativeWrapper
51 popup.xml                       1 Array
52 func_clock.html                 7 Date
53 <null>                         13 MouseEvent
54 <null>                         18 Function
55 browser.js                     20 Function
56
57 FILE                        TOTAL CLASS                   2007 Sep 23 22:59:32
58 <null>                          1 BoxObject
59 <null>                          1 Constructor
60 <null>                          1 HTMLBodyElement
61 <null>                          1 NodeList
62 <null>                          1 UIEvent
63 <null>                          1 XPCNativeWrapper
64 <null>                          1 XPC_WN_ModsAllowed_Proto_JSClass
65 <null>                          1 chrome://global/content/bindings/menu.xml#menu-iconic 84ff45a
66 <null>                          1 chrome://global/content/bindings/menu.xml#menu-iconic 8befbba
67 bookmarksMenu.js                1 Function
68 browser.js                      1 Array
69 browser.js                      1 XPCNativeWrapper
70 popup.xml                       1 Function
71 scrollbox.xml                   1 Function
72 <null>                          2 Event
73 popup.xml                       2 Array
74 bookmarks.js                    3 With
75 firebug-service.js              3 Object
76 bookmarks.js                    6 Object
77 bookmarks.js                    6 XPCWrappedNative_NoHelper
78 func_clock.html                 8 Date
79 firebug-service.js             10 Function
80 <null>                         15 MouseEvent
81 bookmarks.js                   19 Error
82 browser.js                     20 Function
83 bookmarks.js                   22 Function
84 <null>                         39 XPCWrappedNative_NoHelper
85 <null>                         44 Function
86 <null>                         60 RegExp
87 <null>                        191 XULElement
88
89[... 39 seconds deleted ...]
90
91 FILE                        TOTAL CLASS                   2007 Sep 23 23:00:10
92 <null>                          1 HTMLBodyElement
93 <null>                          1 HTMLCollection
94 <null>                          1 TreeColumns
95 <null>                          1 XPCNativeWrapper
96 <null>                          1 XPC_WN_NoMods_Proto_JSClass
97 <null>                          1 XULTreeBuilder
98 <null>                          1 chrome://global/content/bindings/menu.xml#menu-iconic 84ff45a
99 <null>                          1 chrome://global/content/bindings/menu.xml#menu-iconic 8befbba
100 <null>                          1 chrome://global/content/bindings/tree.xml#treebody 84caa3a
101 <null>                          1 chrome://global/content/bindings/tree.xml#treebody 84e3a72
102 <null>                          1 nsXPCComponents_Interfaces
103 <null>                          1 nsXPCComponents_Results
104 bookmarksMenu.js                1 Function
105 browser.js                      1 Array
106 browser.js                      1 XPCNativeWrapper
107 browser.js                      1 XPC_WN_NoMods_Proto_JSClass
108 nsUpdateService.js              1 XPC_WN_NoMods_Proto_JSClass
109 nsUpdateService.js              1 nsJSCID
110 popup.xml                       1 Function
111 scrollbar.xml                   1 String
112 scrollbox.xml                   1 Function
113 tree.xml                        1 Array
114 <null>                          2 Constructor
115 <null>                          2 UIEvent
116 <null>                          2 XPC_WN_ModsAllowed_Proto_JSClass
117 <null>                          2 nsXPCComponents_Classes
118 browser.js                      2 nsJSCID
119 browser.js                      2 nsJSIID
120 utilityOverlay.js               2 nsJSCID
121 utilityOverlay.js               2 nsJSIID
122 <null>                          3 Array
123 <null>                          3 NodeList
124 nsUpdateService.js              3 Array
125 nsUpdateService.js              3 Object
126 nsUpdateService.js              3 With
127 utilityOverlay.js               3 Call
128 tree.xml                        4 Function
129 utilityOverlay.js               4 Function
130 nsUpdateService.js              7 nsJSIID
131 nsUpdateService.js             15 Function
132 bookmarks.js                   22 Function
133 text.xml                       23 String
134 <null>                         36 BoxObject
135 func_clock.html                42 Date
136 bookmarks.js                   57 With
137 firebug-service.js             57 Object
138 bookmarks.js                   73 Error
139 browser.js                     78 Function
140 popup.xml                      82 Array
141 bookmarks.js                  114 Object
142 bookmarks.js                  114 XPCWrappedNative_NoHelper
143 <null>                        157 MouseEvent
144 firebug-service.js            172 Function
145 <null>                        307 XPCWrappedNative_NoHelper
146 <null>                        388 RegExp
147 <null>                        488 Event
148 <null>                        876 XULElement
149 <null>                       1221 Function
150
151 FILE                        TOTAL CLASS                   2007 Sep 23 23:00:11
152 <missed>                      -94 Date
153 <missed>                      -34 Function
154 <missed>                       -4 MouseEvent
155 <missed>                       -2 Array
156 <missed>                       -1 HTMLBodyElement
157 <missed>                       -1 HTMLCollection
158 <missed>                       -1 XPCNativeWrapper
159 <missed>                       -1 XPC_WN_ModsAllowed_Proto_JSClass
160 <null>                          0 Array
161 <null>                          0 HTMLBodyElement
162 <null>                          0 HTMLCollection
163 <null>                          0 RegExp
164 <null>                          0 TreeColumns
165 <null>                          0 UIEvent
166 <null>                          0 XPC_WN_NoMods_Proto_JSClass
167 <null>                          0 XULTreeBuilder
168 <null>                          0 nsXPCComponents_Classes
169 <null>                          0 nsXPCComponents_Interfaces
170 <null>                          0 nsXPCComponents_Results
171 browser.js                      0 Array
172 browser.js                      0 XPCNativeWrapper
173 browser.js                      0 XPC_WN_NoMods_Proto_JSClass
174 browser.js                      0 nsJSCID
175 nsUpdateService.js              0 Array
176 nsUpdateService.js              0 Function
177 nsUpdateService.js              0 Object
178 nsUpdateService.js              0 With
179 nsUpdateService.js              0 XPC_WN_NoMods_Proto_JSClass
180 nsUpdateService.js              0 nsJSCID
181 nsUpdateService.js              0 nsJSIID
182 scrollbar.xml                   0 String
183 text.xml                        0 String
184 tree.xml                        0 Array
185 utilityOverlay.js               0 Call
186 utilityOverlay.js               0 Function
187 utilityOverlay.js               0 nsJSCID
188 <null>                          1 NodeList
189 <null>                          1 XPCNativeWrapper
190 <null>                          1 chrome://global/content/bindings/menu.xml#menu-iconic 84ff45a
191 <null>                          1 chrome://global/content/bindings/menu.xml#menu-iconic 8befbba
192 <null>                          1 chrome://global/content/bindings/tree.xml#treebody 84caa3a
193 <null>                          1 chrome://global/content/bindings/tree.xml#treebody 84e3a72
194 bookmarksMenu.js                1 Function
195 browser.xul                     1 Function
196 func_clock.html                 1 Date
197 popup.xml                       1 Function
198 scrollbox.xml                   1 XULElement
199 scrollbox.xml                   1 nsJSIID
200 <null>                          2 Constructor
201 <null>                          2 XPC_WN_ModsAllowed_Proto_JSClass
202 browser.js                      2 nsJSIID
203 scrollbox.xml                   2 Function
204 tree.xml                        2 Function
205 utilityOverlay.js               2 nsJSIID
206 popup.xml                       3 Array
207 bookmarks.js                    5 With
208 firebug-service.js              5 Object
209 <null>                          6 Event
210 <null>                          6 MouseEvent
211 bookmarks.js                    9 XPCWrappedNative_NoHelper
212 <null>                         10 XPCWrappedNative_NoHelper
213 bookmarks.js                   10 Object
214 browser.js                     10 Function
215 bookmarks.js                   15 Function
216 firebug-service.js             16 Function
217 <null>                         18 BoxObject
218 bookmarks.js                   75 Error
219 <null>                         79 Function
220 <null>                        315 XULElement
221^C
222
223Just after time 23:00:10, garbage collection fired cleaning up many objects.
224The final output shows a much reduced object count including a negative
225count for objects created before this script was tracing.
226
227If over the period of several minutes an object type is still steadily
228increasing, then that would be of interest.  Be patient, depending on the rate
229of object creation it can take over ten minutes for garbage collect to kick in.
230
231