On Thu, Jan 31, 2002 at 05:39:20PM +0100, Stipe Tolj wrote:
> Richard, can we utilize some function to detect memory leaks using the
> checking malloc routines already built-in Kannel?

Yes.  If you turn debug logging on, you will get a list of still-allocated
areas when a process shuts down.  This is done by gw_check_leaks() which
is called by gwlib_shutdown().  To get this, the box has to shut down
normally and not panic.  

In addition, the wapbox will call gw_check_leaks() at runtime if it gets
a SIGQUIT.  This will of course list a lot of areas which are actually
still in use, but it can be useful if you're looking for a memory leak,
because often the leaked areas will far outnumber the areas in real use.
For best effect, send the SIGQUIT when the box is not getting any requests.

What I've done in the past is send a SIGQUIT, then do a lot of requests
of the kind that I suspect are leaking memory, then do another SIGQUIT,
and then only look at the differences.

The SIGQUIT code is in signal_handler() in wapbox.c, and can be easily
copied to the other boxes.

Richard Braakman

Reply via email to