Performance:Leak Tools: Difference between revisions

Jump to navigation Jump to search
(→‎Cycle collector heap dump: update for https://bugzilla.mozilla.org/show_bug.cgi?id=714286)
Line 120: Line 120:


Then evaluate this expression:
Then evaluate this expression:
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
  getInterface(Components.interfaces.nsIDOMWindowUtils).
  cycleCollect(Components.classes["@mozilla.org/cycle-collector-logger;1"]
    .createInstance(Components.interfaces.nsICycleCollectorListener))
In version 11 or earlier, you probably want this version, which will run the GC first:
  window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
  window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
   getInterface(Components.interfaces.nsIDOMWindowUtils).
   getInterface(Components.interfaces.nsIDOMWindowUtils).
   garbageCollect(Components.classes["@mozilla.org/cycle-collector-logger;1"]
   garbageCollect(Components.classes["@mozilla.org/cycle-collector-logger;1"]
     .createInstance(Components.interfaces.nsICycleCollectorListener))
     .createInstance(Components.interfaces.nsICycleCollectorListener))


Nightly builds before 2012 defaulted to all traces, newer builds logs the
Nightly builds before 2012 defaulted to all traces, newer builds logs the
Line 133: Line 140:
   garbageCollect(Components.classes["@mozilla.org/cycle-collector-logger;1"]
   garbageCollect(Components.classes["@mozilla.org/cycle-collector-logger;1"]
     .createInstance(Components.interfaces.nsICycleCollectorListener).allTraces())
     .createInstance(Components.interfaces.nsICycleCollectorListener).allTraces())
If you don't want to run JS garbage collection before cycle collection, use nsIDOMWindowUtils.cycleCollect method:
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
  getInterface(Components.interfaces.nsIDOMWindowUtils).
  cycleCollect(Components.classes["@mozilla.org/cycle-collector-logger;1"]
    .createInstance(Components.interfaces.nsICycleCollectorListener))


This creates a file named cc-edges-NNNN.log and writes a dump of the heap known to the cycle collector, which includes JS objects and also native C++ objects that participate in cycle collection, to the file.
This creates a file named cc-edges-NNNN.log and writes a dump of the heap known to the cycle collector, which includes JS objects and also native C++ objects that participate in cycle collection, to the file.
Confirmed users
626

edits

Navigation menu