memory leaks in dreplsrv

Andrew Bartlett abartlet at
Tue Aug 14 23:12:25 UTC 2018

On Fri, 2018-08-03 at 09:15 +0200, Andrej Gessel via samba-technical
> Hello list,
> I found some more mem leaks, that I missed last time.
> Please review.
> PS: I'm searching for mem leaks, because dreplsrv on RODC with samba 
> 4.8.3 was killed because of oom, so I'm trying to fogure out where 
> memory is lost and why it's happening.

G'Day Andrej,

A few hints:  
 - smbcontrol can get a talloc dump from a process

 - If the memory is not leaked, but instead just touched, it can show
up as a large process.  The classic example is a full DB search against
the LDAP server, with the socket left open.  This is because in unix,
free() does not return memory to the kernel, it remains in the process
for re-use. 

 - While I've not tested this on Samba, I would try a flame graph:

 - Try and reproduce the issue in 'samba-tool drs replicate --local' as
that will be easier to trace and debug, as it will all be in that
python process.

Thanks for all your attention on this!

Andrew Bartlett

Andrew Bartlett
Authentication Developer, Samba Team
Samba Development and Support, Catalyst IT

More information about the samba-technical mailing list