canmove, Confirmed users, Bureaucrats and Sysops emeriti
1,334
edits
(add a few sections) |
|||
| Line 7: | Line 7: | ||
Because it is based on instrumentation, it is not reliable for gathering aggregate statistics. (In spite of this, it is currently used for the leak stats on tinderbox, although a trace-malloc based replacement is in development.) 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. | Because it is based on instrumentation, it is not reliable for gathering aggregate statistics. (In spite of this, it is currently used for the leak stats on tinderbox, although a trace-malloc based replacement is in development.) 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 on | These tools work best on Linux, although they work reasonably well on Mac (except that nsCOMPtr logging doesn't work). Some people claim to have seen them work on Windows, but I haven't been able to get them to work. They are built by default in debug builds. In Linux optimized builds they can be built with --enable-logrefcnt. In Windows optimized builds they can be built by setting FORCE_BUILD_REFCNT_LOGGING=1 (?). | ||
See below for a detailed description of how to use the refcount balancer effectively. | See below for a detailed description of how to use the refcount balancer effectively. | ||
| Line 13: | Line 13: | ||
=== Trace-malloc === | === Trace-malloc === | ||
The trace-malloc code consists of the nsTraceMalloc code in [http://lxr.mozilla.org/mozilla/source/tools/trace-malloc/lib/ mozilla/tools/trace-malloc/lib/] and the perl scripts and trace-malloc readers in [http://lxr.mozilla.org/mozilla/source/tools/trace-malloc/ mozilla/tools/trace-malloc/]. It works by overriding / hooking into malloc and free (and related functions) and logging all calls, with stacks. It is probably the best tool we currently have for gathering aggregate memory usage statistics. It is generally more useful for bloat measurement than leak measurement, but it can be used to find leaks. It works on | The trace-malloc code consists of the nsTraceMalloc code in [http://lxr.mozilla.org/mozilla/source/tools/trace-malloc/lib/ mozilla/tools/trace-malloc/lib/] and the perl scripts and trace-malloc readers in [http://lxr.mozilla.org/mozilla/source/tools/trace-malloc/ mozilla/tools/trace-malloc/]. It works by overriding / hooking into malloc and free (and related functions) and logging all calls, with stacks. It is probably the best tool we currently have for gathering aggregate memory usage statistics. It is generally more useful for bloat measurement than leak measurement, but it can be used to find leaks. It works on Linux and is close to working on Windows. On Linux it can be built by checking out mozilla/tools/trace-malloc/ and building with --enable-trace-malloc. On Windows it can be built by checking out mozilla/tools/trace-malloc/ and (?). | ||
'''Update''' (2003-06-16): There is a new trace-malloc tool, leaksoup, that is useful for finding leaks. See below for more information on how to use it. | '''Update''' (2003-06-16): There is a new trace-malloc tool, leaksoup, that is useful for finding leaks. See below for more information on how to use it. | ||
| Line 84: | Line 84: | ||
== Getting symbol information for system libraries == | == Getting symbol information for system libraries == | ||
== Leak statistics on tinderbox == | == Leak statistics on tinderbox == | ||