Memory leak with dev_add_pack()

Michael Blizek michi1 at michaelblizek.twilightparadox.com
Sun Jan 23 11:20:22 EST 2011


Hi!

On 21:22 Sun 23 Jan     , anish kumar wrote:
> > The funny point is that buffer_head belongs to the filesystem subsystem. 
> > What
> > file systems are you using? Could it be that your code just triggers the
> > memory leak, because data is logged to disk, e.g. to /var/log/kern.log ?
> I did small experiment with your code.I removed all your logs which were 
> getting
> logged in kernel buffers(kern.log).With this change i checked the "meminfo" 
> and found that
> the memory leaking is almost same as compared to normal case(with no change 
> in your code).
> 
> >
> > I have tried your program on my virtual machine (2.6.28) and could see any
> > leak, but maybe data is leaked very slowly...
> i confirm that data is leaking very slowly (below is the output i got on my 
> ubuntu machine
> with removed logs from your code).
> 
> $date
> Sun Jan 23 19:13:47 RET 2011
> 
> $ head -n5 /proc/meminfo
> MemTotal:        1018172 kB
> MemFree:          373708 kB
> Buffers:           32232 kB
> Cached:           296004 kB
> SwapCached:            0 kB
> 
> $ date
> Sun Jan 23 19:15:03 RET 2011
> 
> $ head -n5 /proc/meminfo
> MemTotal:        1018172 kB
> MemFree:          373584 kB
> Buffers:           32248 kB
> Cached:           296004 kB
> SwapCached:            0 kB
> 
> With logs enabled in your code i can see marginal increase in leaking 
> memory.

This small increase could easily be caused by background activity. Please try
to reproduce this in single user mode with all file systems mounted read-only
(use e.g. "mount -o remount,ro /") and no processes running except init and
your shell. Then see if memory increase is both correlated to network traffic
and reason of system crashes. If it takes too long, you can add e.g.
"mem=32M" to the kernel boot parameter list in the bootloader.

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com




More information about the Kernelnewbies mailing list