Subject: Still a memory leak in Samba / libc somewhere?
To: None <>
From: Mark Cullen <>
List: netbsd-users
Date: 09/10/2006 02:34:37
A while a back I was here complaining about a massive memory leak in 
Samba, which turned out to be something to do with libc's telldir().

I applied some patches that I found, dated back many years ago, which 
converted telldir() to use a linked list rather than a hash table. This 
*seemed* to fix the issue.

Yesterday I had a look at all the smbd processes memory usages to make 
sure, after being up for ~30 days, and found that the smbd process for 
*my* computer was using ~30MB of memory! What's strange is that it only 
seems to be the smbd process related to my computer, all the others were 
normal ~4MB. I do tend to make use of my network shared drive on the 
server more than other family members though, and I have much more 
things running in the background on my machine.

It seems to be something related to directories-ish. Before, if I sat 
and held F5 in a single directory the memory usage would slowly climb 
up. This is now fixed with the patches, but browsing around different 
directories seems to make it climb very slowly (4 - 8 bytes?), seemingly 
quite random. It doesn't seem to increase on *every* navigation from 
directory to directory, only some times?

Anyway, I went hunting for a directory full of files somewhere in my 
home folder, and ended up staring at 'Temporary Internet Files'. These 
hadn't been deleted for a while, about ~100MB in there! I don't even use 
IE so god knows why it was all there! I selected it all over Samba, and 
hit delete. Memory usage before hitting delete was ~12MB ( I restarted 
my smbd process yesterday, in 1 night it managed to go from 4MB to 12MB 
somehow ), and once the deleting finished it was at 17.5MB. Copying 
'audio' from pkgsrc (via SSH) to my user home, then deleting this via 
Samba also seems to make the memory usage slowly increase.

Perhaps someone else can try coping part of pkgsrc to a directory shared 
by Samba, then try deleting the directory over Samba, with NetBSD 
3-current (still a bit confused with NetBSD tags, this exists though 
right?) or with libc patched to use the linked list, and tell me if they 
also experience this issue?

I am rather lost trying to track it down myself :-( To be honest, I dont 
even know where to start looking, so any help at all would be great!

Mark Cullen <>
BSc (Hons), Computer Science