[Samba] Memory leak in 3.0.22?

Mark Cullen mark.r.cullen at gmail.com
Mon Jun 26 19:53:32 GMT 2006

Jeremy Allison wrote:
> On Sun, Jun 25, 2006 at 10:48:35PM +0100, Mark Cullen wrote:
>>I have just switched from FreeBSD 4.11 using 3.0.21b to NetBSD 3.0.1 
>>using 3.0.22. With the same configuration, and the same clients, I am 
>>now seeing what appears to be some rather large memory leakage [ I am 
>>not sure if this is the fault of Samba or NetBSD ]. Eventually the 
>>process will run out of memory (machine only has 256MB of RAM) and the 
>>Windows clients (2000, SP4 and all the latest updates) pop up a message:
>>"Insufficient system resources exist to complete the requested service"
>>At which point the Samba server becomes unresponsive to the current user 
>>logged in. At the same time, I am seeing alot of errors in the logs 
>>regarding memory allocation errors:
> Try doing a smbcontrol <pid> pool-usage to get the amount of
> memory in the talloc pools. I doubt this is a Samba bug as
> such a problem has not been widely reported on other platforms.

I think you may well be right. There was a memory leak in telldir() 
reported about 2 years ago that remains unfixed. I applied the patches 
in the PR [1] and it appears to have, at the very least, significantly 
reduced the leak. I am now able to hold F5 to refresh (Windows explorer) 
on a Samba share and the memory usage no longer constantly increases at 
least! I still seem to be seeing a bit of memory not being free'd (I 
think) when I copy a large directory tree, but if I then copy that same 
tree *again* it does not use any more memory. I think maybe it might get 
free'd eventually possibly. Time shall tell.

Anyhow, apologies for the noise!

> Is there a MALLOC_DEBUG option in the NetBSD malloc that will
> dump out where the memory is going ?
> Jeremy.

[1] http://mail-index.netbsd.org/netbsd-bugs/2004/02/05/0008.html

More information about the samba mailing list