Re: XMALLOC_TRACE

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Thu, 13 Sep 2001 15:17:56 +0200

xmalloc-trace writes a trace of all memory allocated by xmalloc and friends.
This trace can then be post-processed to try to identify any potential leak.

I have never made use of the xmalloc-trace function. Here is how I go about
hunting memory leaks:

a) First check if it shows up in cachemgr memory pools statistics.

b) If not, run a decent malloc leak finder.


Personally I use RedHat's "memprof" on Linux. There is several other leak
detector, but I have found memprof to be very simple to use for finding memory
leaks and only adds marginally to the overhead. Just start it, push "run" to
start the application, and let it run until you think there is a leak. Then
push the button "leaks" and after a short while you get a interactive listing
of all leaks and their calltraces. The tool uses "garbage collection" to find
leaks by identifying allocated memory areas where there is no pointer referring
to them. It also has the equivalence of a realtime xmalloc-trace processor,
showing a graph of where memory is allocated.

So far, all memory leaks I have experienced has either shown up in the mempools
statistics or in memprof.

Note: memprof cannot find leaks from cbdata due to how cbdata is constructed.
It thinks all cbdata allocated memory is in use.

There is also an experimental built-in leak detector in the Squid sources.. but
I doubt it works very well these days.

--
Henrik

"Chemolli Francesco (USI)" wrote:

> A couple of hours ago I sent a message to squid-dev about XMALLOC_TRACE,
> but still haven't seen it back.
> While you seem to be online, I'd like to ask you if it can be used to
> detect leaks, and if so how (I'm seeing figures of 60 leaked bytes/request).
>
> Thanks.
>
> --
> /kinkie
Received on Thu Sep 13 2001 - 07:17:37 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:20 MST