Re: detecting kernel mem leak

From: Christoph Lameter
Date: Tue Apr 29 2008 - 12:59:00 EST


On Tue, 29 Apr 2008, Pekka Enberg wrote:

> 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).

For slub: Just enable debugging and then do a cat on
/sys/kernel/slab/<cachename>/allocs or frees to see where memory is
allocated or freed.


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

If you run a report on a slabcache with f.e.

slabinfo kmalloc-2048

and debugging is enabled then all functions that allocate and free objects
in kmalloc-2048 are listed.

Just doing
slabinfo

list all caches with the number of objects allocated.

--
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/