Re: Memory leak in kernel 2.0.32pre1.

Daniel Ryde (ryde@tripnet.se)
Tue, 18 Nov 1997 17:21:34 +0100 (CET)


Ok, I had to reboot it yesterday, since it started to swap. Here's the
last uptime;free I made:

9:42am up 6 days, 18:54h, 9 users, load average: 0.00, 0.01, 0.00
total used free shared buffers cached
Mem: 31132 30632 500 12248 256 1588
-/+ buffers: 28788 2344
Swap: 66492 1832 64660

I'm testing the real 2.0.32 now but I guess it will have the same bug.

I have a suggestion here: would'nt it be a Good Thing (tm) to always have
some latent code that can be enabled at compiletime, to generate some
general malloc/free statistics.
In some central kernel-memory allocating place, like in kmalloc.c
(this seems like the most resonable), put two hashed tables, one
for allocations and one for freeings. Both tables should hash the
address from where it was called and add the amount of memory
allocated/freed to its value. Then I guess it should be pretty simple to
put these tables into the proc filesystem and from there spot the leak.
The hash algoritm could be made pretty simple by just taking the least
significant byte of the calling address and use that as the hash.

I guess this would generally save a lot of brain time when debugging these
obscure memory leaks.

Useful? Possible? Comments? Other ideas?

Best Regards

Daniel Ryde, System Administrator
__________________________________________________________________________
Tripnet AB Visit Address: Telephone: +46 31 7252500
Box 5071 Avagen 42 Facsimile: +46 31 7252501
S-402 22 GOTEBORG GOTEBORG Email: ryde@tripnet.se
Sweden Sweden

On Sat, 15 Nov 1997, Daniel Ryde wrote:
[snip]
> Here are some example memory statistics:
> 4:30pm up 42 min, 13 users, load average: 0.08, 0.06, 0.01
> total used free shared buffers cached
> Mem: 31132 30580 552 23064 4872 13856
> -/+ buffers: 11852 19280
> Swap: 66492 0 66492
>
> 7:06pm up 3 days, 4:18h, 14 users, load average: 0.03, 0.07, 0.02
> total used free shared buffers cached
> Mem: 31132 30444 688 18740 7928 5360
> -/+ buffers: 17156 13976
> Swap: 66492 512 65980
>
> 4:20pm up 4 days, 1:31h, 13 users, load average: 0.06, 0.03, 0.00
> total used free shared buffers cached
> Mem: 31132 30688 444 20032 2980 5780
> -/+ buffers: 21928 9204
> Swap: 66492 688 65804
>
> 3:21pm up 5 days, 33 min, 11 users, load average: 0.00, 0.02, 0.00
> total used free shared buffers cached
> Mem: 31132 30264 868 19508 3300 3240
> -/+ buffers: 23724 7408
> Swap: 66492 564 65928
[snap]