Dmitry Torokhov wrote:
On 8/5/05, Pekka Enberg <[email protected]> wrote:
This patch converts kcalloc(1, ...) calls to use the new kzalloc() function.
Hi,
Have you seen the following in include/sound/core?
...
#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
#define kfree(obj) snd_hidden_kfree(obj)
Arghh... I've been bitten by this before, too.
Pekka, the sound subsystem uses its own allocation functions that are
just defined to the standard kernel counterparts when
CONFIG_SND_DEBUG_MEMORY is not defined, but that map to their own
functions that add aditional debug information when that config is set.
To play well with the current structure you have to define you own
snd_hidden_kzalloc(size, flags) and use the same scheme.
For my previous encounter with this problem search a thread named
"replace snd_kmalloc_strdup by kstrdup". The patch there might useful to
you.
I really hate this "#define kmalloc" hack. It makes the code really
unreadble, because you expect a kmalloc to be just a kmalloc...
Couldn't we turn this into a generic kernel debugging option, so that it
could be used for every kmalloc instead of just the ones from the sound
system?
If I get this right, what this code does is to track kfree's on pointers
that were not alloc'ed with kmalloc (using a magic number) and keep
track of all the allocations to detect leaks.
We already have SLAB_DEBUG. We could add a list of allocations with a
proc interface (or something) to give an histogram of kmalloc callers /
number of allocations not yet freed.
This way, if after stopping everything related to sound there were still
callers like "snd_xxxx" (through kallsyms) you would know there is a
leak there.
What does CONFIG_SND_DEBUG_MEMORY provide that this more generic scheme
does not?
--
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com
It is a mistake to think you can solve any major problems
just with potatoes.
Douglas Adams
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|