Re: How to analyze kmemleak message?
From: Tetsuo Handa
Date: Mon Feb 23 2009 - 08:00:12 EST
Hello.
Catalin Marinas wrote:
> On Mon, 2009-02-23 at 20:29 +0900, Tetsuo Handa wrote:
> > void *p1;
> >
> > void foo(void)
> > {
> > void *p2 = kmalloc(1, GFP_KERNEL);
> > p1 = kmalloc(1, GFP_KERNEL);
> > }
> >
> > "p1" will be reported by default.
>
> p1 won't be reported as a leak because it is a global variable and the
> data section is scanned.
>
I see.
> > To report "p2", we need to write "stack=on" to /sys/kernel/debug/kmemleak .
>
> It's the opposite - p2 will be reported as leak by default (stack=off)
> unless you enable the stack scanning (stack=on).
>
I see.
> I don't think you need to do anything here. Since p is a static local
> variable, isn't it placed in a data section somewhere (and automatically
> scanned by kmemleak)?
>
I see.
After all, I have nothing to modify for kmemleak. All I need to do is
"Just turn on kmemleak and see if functions in my module are reported or not".
Thank you.
--
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/