[Gllug] Troubleshooting Memory Leak

- Tethys tethys at gmail.com
Wed Mar 25 14:46:46 UTC 2009


On Tue, Mar 24, 2009 at 5:01 PM, Stephen Nelson-Smith
<sanelson at gmail.com> wrote:

> However, I am unable to see the malloc's, and I can't currently think
> of a way to test this theory.
>
> I suspect systemtap may be the tool to use - anyone have experience of
> using it in this way, or have a recipe they could point me to?

I don't have a CentOS box in front of me right now, but under Fedora,
you need to install the systemtap, kernel-devel and kernel-debuginfo
packages (without which you'll get a pointlessly cryptic "libdwfl
failure" error message). Then create a suitable stap script, and away
you go. Here's one I knocked up to show you each process that calls
brk(2), and the argument passed to it:

	#!/usr/bin/env stap

	probe begin
	{
			printf("Starting\n");
	}

	probe syscall.brk
	{
			printf("%s: %s\n", execname(), argstr);
	}

Of course, there is almost no end to what you can query at the point
of the syscall (both on entry and exit). Documentation can be found
on the systemtap wiki, albeit sometimes of variable quality.

There are also sample stap scripts on the site for looking at slab
allocations, if you believe the leak to be there (although from
your description, I'd say probably not).

Tet

-- 
The greatest shortcoming of the human race is our inability to
understand the exponential function -- Albert Bartlett
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list