2008-12-08 22:18:23

by Larry Finger

[permalink] [raw]
Subject: How to check for memory leaks

What is the best way to check if there is a memory leak?

If I start a ping running on my system using the rtl8187 driver, and nothing
else active on my system, I see an increase in the "slab" value in /proc/meminfo
of about 65 kB/minute. Is this indicative of a memory leak? When I run the same
test with p54usb, the increase is only 20 kB/min.

Thanks,

Larry


2008-12-08 22:33:37

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: How to check for memory leaks

2008/12/8 Larry Finger <[email protected]>:
> What is the best way to check if there is a memory leak?
>
> If I start a ping running on my system using the rtl8187 driver, and nothing
> else active on my system, I see an increase in the "slab" value in /proc/meminfo
> of about 65 kB/minute. Is this indicative of a memory leak? When I run the same
> test with p54usb, the increase is only 20 kB/min.
>
> Thanks,
>
> Larry


Hi,

You could have a look on kmemleak: http://www.procode.org/kmemleak/
It's up to date version is on the arm development git branch (topic kmemleak):
http://www.linux-arm.org/git?p=linux-2.6.git;a=summary

2008-12-09 01:38:50

by J.R. Mauro

[permalink] [raw]
Subject: Re: How to check for memory leaks

On Mon, Dec 8, 2008 at 5:33 PM, Fr?d?ric Weisbecker <[email protected]> wrote:
> 2008/12/8 Larry Finger <[email protected]>:
>> What is the best way to check if there is a memory leak?
>>
>> If I start a ping running on my system using the rtl8187 driver, and nothing

Is this the driver in the staging tree or a different one?

>> else active on my system, I see an increase in the "slab" value in /proc/meminfo
>> of about 65 kB/minute. Is this indicative of a memory leak? When I run the same
>> test with p54usb, the increase is only 20 kB/min.
>>
>> Thanks,
>>
>> Larry
>
>
> Hi,
>
> You could have a look on kmemleak: http://www.procode.org/kmemleak/
> It's up to date version is on the arm development git branch (topic kmemleak):
> http://www.linux-arm.org/git?p=linux-2.6.git;a=summary
> --
> 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/
>

2008-12-09 01:45:53

by Larry Finger

[permalink] [raw]
Subject: Re: How to check for memory leaks

J.R. Mauro wrote:
>
> Is this the driver in the staging tree or a different one?

This is the driver in wireless-testing, which is essentially the same as the one
in mainline.

Larry

2008-12-09 01:50:14

by Larry Finger

[permalink] [raw]
Subject: Re: How to check for memory leaks

Fr?d?ric Weisbecker wrote:
>
> You could have a look on kmemleak: http://www.procode.org/kmemleak/
> It's up to date version is on the arm development git branch (topic kmemleak):
> http://www.linux-arm.org/git?p=linux-2.6.git;a=summary
>

I downloaded the git tree, but x86_64 architecture won't build in the kmemtest
branch. I've built an i386 kernel that I will install on a different machine.
Once I get that working, I'll try to fix the other problem and post a patch.

Larry

2008-12-09 09:03:42

by Hinko Kocevar

[permalink] [raw]
Subject: Re: How to check for memory leaks

Larry Finger wrote:
> What is the best way to check if there is a memory leak?
>
> If I start a ping running on my system using the rtl8187 driver, and nothing
> else active on my system, I see an increase in the "slab" value in /proc/meminfo
> of about 65 kB/minute. Is this indicative of a memory leak? When I run the same
> test with p54usb, the increase is only 20 kB/min.
>

Also see cat /proc/slabinfo (you need to compile some debugging feature to get access to
/proc/slabinfo).

HTTH,
Hinko

--
Hinko Kočevar, OSS developer
ČETRTA POT, d.o.o.
Planina 3, 4000 Kranj, SI EU
tel ++386 (0) 4 280 66 03
e-mail [email protected]
http http://www.cetrtapot.si