From 73049f4edd7645252ec032b2f738debff3e92505 Mon Sep 17 00:00:00 2001
From: "mcafee%netscape.com"
To use leaky you must first build it. I've made it work only on x86
-linux. To work on other platforms you will need to:
- By setting the LIBMALLOC_LOG environment variable you control how much
+ By setting the Once your program has completed execution you can use leaky to look
@@ -86,14 +98,11 @@ file of around 5 to 10 megabytes and the resulting converted log file will
be 10 to 20 times that so be prepared to have alot of disk space. It helps
a great deal to narrow down your problem space to reduce the log file size...
+ A quick additional note. Leaky now has a "graph" output option.
-If you do this:
-About Leaky
+
Leaky is a program which will help you find memory leaks, and as of late,
-help you debug reference count problems with xpcom objects.
-
-
-After its built, you can use TestPreload and TestMalloc and ShowLibs to
+
+Using Leaky
+
+
-
+Leaky is not currently part of the default SeaMonkey module,
+you will need to explicitly pull the source:
+
+
+ cvs checkout mozilla/tools/leaky
+
+If there is enough demand, we can make this part of
+the default SeaMonkey module.
+
+
-
+
+ ./configure --enable-leaky
+
+Top-of-tree build should Just Build It and leaky will show up in dist/bin.
+
+
-
+
+After it has been built, you can use TestPreload and TestMalloc and ShowLibs to
debug your implementation.
-LIBMALLOC_LOG environment variable you control how much
information is logged during the programs execution. See libmalloc.h for
-a definition of the values to use. If you are using LD_PRELOAD, here is
+a definition of the values to use. If you are using LD_PRELOAD, here is
one way to run your program:
env LD_PRELOAD=/full/path/to/libleaky.so LIBMALLOC_LOG=1
my-program
-The debugging malloc library creates two files - "malloc-log" and "malloc-map".
+The debugging malloc library creates two files, malloc-log and malloc-map.
The malloc-log file can be quite large for large programs (e.g. mozilla)
so be prepared to have alot of disk space. The malloc-map is tiny.
-
-
-leaky -gqx viewer malloc-log | c++filt | sed -e 's/&/&/g' > /tmp/GQ0.html
-
+Leaky now has a "graph" output option. If you do this:
+ leaky -gqx <program-name-goes-here> malloc-log | c++filt | sed -e 's/&/&/g' > /tmp/GQ0.html
Then leaky will make a graph of the leaks [-g] and output that graph in xml format (currently actually html...) [-x]. I use c++filt to translate the C++ mangled names into ascii and then use sed to make it @@ -103,5 +112,33 @@ legitimate html and off it goes to a file.
present you with a treeview of the leaks that you can click on to open/close sections. Enjoy! +Initial version works only on x86 linux. To work on other platforms you will need to: +
CrawlStack() in libmalloc.cppDumpAddressMap() in libmalloc.cpp and in ShowLibs.cpp