Re: [PATCH] /proc/kmalloc
From: Baruch Even
Date: Sun Feb 20 2005 - 21:46:39 EST
Matt Mackall wrote:
I've been sitting on this for over a year now, kicking it out in the
hopes that someone finds it useful. kernel.org was down when I was
tidying this up so it's against 2.6.10 which is what I had handy.
/proc/kmalloc allocation tracing
This quick hack adds accounting for kmalloc/kfree callers. This can
aid in tracking down memory leaks and large dynamic memory users. The
stock version use ~280k of memory for hash tables and can track 32k
active allocations.
One thing I've seen once that might be worth adding is the ability to
mark generations and then ask "what allocations exist from generation x?".
So you do something like:
echo 5 > /proc/kmalloc_generation
run some tests
echo 6 > /proc/kmalloc_generation
Print all allocations from generation 5:
echo 5 > /proc/kmalloc_print_generations
Now you get all buffers that were allocated in generation 5 and not
released. Not all of these are leaks, but it's easier to wade through
this list to see what is and what isn't a leak.
Sometimes it's better to summarize all allocations according to the
caller who asked for the allocation, it makes it easier to see if there
is an undue increase from certain callers.
Just some ideas.
Baruch
-
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/