[PATCH] Remove all uses of talloc_autofree_context() from our code (except for test)

Jeremy Allison jra at samba.org
Tue Jul 25 20:04:29 UTC 2017

On Tue, Jul 25, 2017 at 09:58:06PM +0200, Volker Lendecke wrote:
> On Tue, Jul 25, 2017 at 12:37:24PM -0700, Jeremy Allison wrote:
> > > Does "smbcontrol smbd pool-usage" still work after this change?
> > 
> > No. If we're not using the global null_context within
> > talloc anymore, then pool usage doesn't have a central
> > place to track all allocations off it.
> That's tough. I definitely want pool-usage to be available everywhere
> and always. When you need it, it's too late to activate it.

Having it available "everywhere and always" is inconsistent
with the design criteria behind this patchset. For that you
need a completely MT-safe talloc - you know it and I know it :-).

If you'd have mentioned that in the beginning then I wouldn't
have spent literally *months* of work getting this done and
cleaning up the code to this state.

talloc_autofree_context() is my 'nested event loops' :-). Having
it in the code hides real bugs and complicates memory management
by giving a lazy option everyone uses. It's how we ended up
with the module initialization mess and other design problems.

Is there some compromise we can come to of starting smbd
with a --track-pool usage parameter ?

If you've got a leak that can be reproduced then it's usually
possible to recreate it with a restart of the smbd binary.


More information about the samba-technical mailing list