Re: detecting kernel mem leak

From: Pekka Enberg
Date: Tue Apr 29 2008 - 08:46:57 EST


On Tue, Apr 29, 2008 at 12:41 PM, <sancelot@xxxxxxx> wrote:
> I noticed the memory was growing without doing anything in my system ....after
> some investigations , it looks like some kernel components may be involved in
> this problem.
>
> I would like to know if there is a way to monitor activity of memory (de)alloc
> of the kernel in order to target which partof the system/kernel could do this..?

You can do

cat /proc/meminfo | grep Slab

and if that grows too much over time you can do

cat /proc/slabinfo

or use a tool such as slabtop to see where the memory is going. If the
memory is being leaked in the kmalloc caches, you can use
CONFIG_DEBUG_SLAB_LEAK which part of the kernel is doing all those
allocations (not really suitable for production machines).

Also remember to check that Active + Inactive + Buffers + Cached is
roughly the same size as MemTotal - MemFree; otherwise your kernel
might be leaking full pages.

Christoph, I suppose there's some option to
Documentation/vm/slabinfo.c that provides similar output to
CONFIG_DEBUG_SLAB_LEAK for SLUB?

Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/