Changes

Jump to: navigation, search

Performance:Leak Tools

1,764 bytes removed, 17:02, 13 July 2012
Cycle Collector Debugging (DEBUG_CC): DEBUG_CC is no more
When a leak is detected, the extension presents the user (or application/extension developer!) with a dialog with information about the leaked objects. (The alerts can also be triggered by bugs in the core code. See the [http://dbaron.org/mozilla/leak-monitor/ extension's homepage] for more details.)
 
==== Cycle Collector Debugging (DEBUG_CC) ====
 
For leaks involving windows, documents, or content nodes (the first two of which show up with leak-gauge), and for many other large graphs of objects that are cycle collected, the cycle collector debugging code can be useful.
 
The cycle collector debugging code can be enabled by uncommenting the <code>#define DEBUG_CC</code> lines in '''both''' <code>xpcom/base/nsCycleCollector.h</code> and <code>xpcom/glue/nsCycleCollectionParticipant.h</code>.
 
The cycle collector debugging code relies on being told that cycle-collected objects are expected to be garbage. This is done through the functions <code>nsCycleCollector_DEBUG_shouldBeFreed</code> and <code>nsCycleCollector_DEBUG_wasFreed</code>. When using the cycle collector debugging, it may be helpful to add additional calls to these functions (or maybe even remove some of the existing ones if they add noise). It may also be useful to look only at the cycle collection that happens at shutdown (which can be done by surrounding the call to <code>ExplainLiveExpectedGarbage</code> in <code>nsCycleCollector::Collect</code> with <code>if (origTryCollections > 1)</code>.
 
When this code is enabled, it prints an explanation of what is keeping alive any objects that are expected to be garbage but are not collected. This means it will print information about what objects from which they are reachable have reference counts that the cycle collector does not know about; you can then debug the leak starting from these objects. It also prints the path from the object keeping this alive to the closest object that it is keeping alive, and if the object keeping things alive is a JS object, it prints all the objects from which that object is reachable.
==== JavaScript heap dump ====
Confirm
557
edits

Navigation menu