[lug] Best way to locate a memory leak
stimits at attbi.com
Tue Feb 4 21:50:44 MST 2003
Elyse Grasso wrote:
> Our web and mail server may be running something that has a memory leak.
> Most likely on the webserver side. What tools do people like for
> tracking things like this down?
Ordinary ps and top have options that can identify and classify memory
of various processes. If you are trying to find a *process* to identify,
those might be enough. Combine it with "watch" and "grep", you can
probably narrow it down. Use the "f" option for ps to display based on a
sort of tree branch view, and you can get an idea of child/parent
watch 'ps auxf | grep httpd'
If this is C or C++ code that you have the source for, and can do some
time-consuming editing and compiling, you might check out memory
allocation wrappers like dmalloc.
> We've recently added some large downloadable files on our website, as
> well as the BURP tool for registering visitors to the download site.
> Could either of these be the culprit? What's the best way to find out?
Perhaps the files, during download, are being MIME encoded or otherwise
processed, taking memory temporarily. Are you sure memory is being used
up...not just cached? Cached memory does not show as free memory, but it
is in reality available as soon as something needs it. In X11, xosview
is nice for a quick glance at memory on the system.
D. Stimits, stimits AT attbi DOT com
More information about the LUG