Changes

Jump to: navigation, search

Performance:Leak Tools

1,536 bytes removed, 23:55, 27 October 2014
trace-refcnt and the refcount balancer
=== Leak tools for medium-size object graphs ===
==== trace-refcnt BloatView, and the [http://mozilla.org/performance/refcnt-balancer.html refcount balancer] tracing and balancing ====
The refcount balancer consists of the [http://mxr.mozilla.org/mozilla-central/source/xpcom/base/nsTraceRefcntImpl.cpp nsTraceRefcnt] code in xpcom/base and the perl scripts in BloatView is documented on [httphttps://mxrdeveloper.mozilla.org/mozillaen-centralUS/sourcedocs/toolsMozilla/rb/ tools/rbPerformance/BloatView MDN]. It works by instrumenting refcounting, so every AddRef and Release method created using NS_IMPL_ISUPPORTSn and variants, NS_IMPL_ADDREF, or NS_IMPL_RELEASE is automatically instrumented. It also logs information for non-refcounted objects instrumented using the MOZ_COUNT_CTOR and MOZ_COUNT_DTOR macros.
Because it is based on instrumentation, it Refcount tracing and balancing is not reliable for gathering aggregate statistics. (In spite of this, it is used for the "RLk" leak stats on tinderbox, so the trace-malloc-based "Lk" numbers are more meaningful.) However, it is by far the best tool we have for ''debugging'' leaks of reference counted objects, which are the leaks in Mozilla that can entrain the largest object graphs. These tools work on Windows, Mac (PPC and Intel), and Linux (x86), although nsCOMPtr logging doesn't work also documented on Windows (?) and Mac and Linux stack traces require some post-processing (see [[#Post-processing of stack traces|below]]). It can be used on any standard --enable-debug build, or on a --disable-debug build with --enable-logrefcnt. '''Getting leak statistics'''. To enable summary statistics, simply set XPCOM_MEM_LEAK_LOG to 1 (stdout), 2 (stderr), or a filename. In this mode, trace-refcnt will tell you what types of objects leaked, but won't tell you why they leaked. '''Using the refcount balancer'''. See the [httpMDN https://www-archivedeveloper.mozilla.org/performanceen-US/docs/Mozilla/Performance/leak-tutorial.html tutorial on finding leaks of XPCOM objectsRefcount_tracing_and_balancing] for information on debugging leaks using the refcount balancer.
==== Leaksoup ====
Confirm
1,345
edits

Navigation menu