[PATCH] talloc_free_for_exit() and targeted write protection for talloc destructor

Andrew Bartlett abartlet at samba.org
Mon Nov 28 22:36:31 UTC 2016

On Mon, 2016-11-28 at 21:12 +0100, Volker Lendecke wrote:
> On Tue, Nov 29, 2016 at 07:13:53AM +1300, Andrew Bartlett wrote:
> > As background, I want to make our LDAP server multi-process, and
> > running a connect()/bind()/close() loop against the LDAP server
> > showed
> > a significant cost in talloc_free(ev) and talloc_autofree() just
> > before
> > exit.
> > 
> > This made me think about a way to make Samba 'forget' to call
> > free() or
> > inspect talloc children that did not have a destructor to fire. 
> Can we get this a lot more general by applying this principle for
> talloc
> pools? If a talloc pool is clean, i.e. no destructors and no objects
> "stolen" from it, we can just free the pool with one call to free().
> This
> would just achieve about the same and at the same time help with more
> than just the exit case.

Yes, I noticed this possibility as well.  I don't propose to add that
to this set (there are a lot of corner cases around children that
didn't fit, the stolen objects you mention etc), but I certainly was
expecting that someone, probably your good self, would wish to add such
an extension.


Andrew Bartlett

Andrew Bartlett
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT   

More information about the samba-technical mailing list