talloc_tos() vs NULL and threads

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Apr 4 14:39:10 MDT 2014


On Sat, Apr 05, 2014 at 08:09:18AM +1300, Andrew Bartlett wrote:
> On Fri, 2014-04-04 at 16:15 +0200, Volker Lendecke wrote:
> > On Fri, Apr 04, 2014 at 09:26:31AM +1300, Andrew Bartlett wrote:
> > > What would, I think, be a reliable solution that can co-exist with
> > > threads is to move from talloc_tos() to talloc_stackframe(), with an
> > 
> > You mean that wherever we now do a talloc_tos() instead
> > allocate a new frame? If that's not what you meant, can you
> > describe what you have in mind a bit differently?
> 
> That is what I'm suggesting.  As always with memory management, nothing
> is easy, I'm just suggesting a different set of compromises. 

By the way, beyond the performance aspect this also has
semantic implications: talloc_stackframe() does check the
reverse free'ing order. I'm sure we don't properly free the
objects in reverse order if we have multiple talloc_tos()
calls within one routine. It might be nice to have, because
this would ensure that we can re-use memory, but this might
be too much.

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list