talloc pools -- if someone feels like it, please comment
jra at samba.org
Wed Jan 9 23:22:37 GMT 2008
On Thu, Jan 10, 2008 at 10:16:35AM +1100, Andrew Bartlett wrote:
> On Wed, 2008-01-09 at 18:45 +0100, Volker Lendecke wrote:
> > Hi!
> > Attached find a patch that potentially speeds up Samba 3
> > considerably. I've talked about this to Jeremy, Tridge and
> > Metze already, and I think I've addressed most concerns. In
> > particular talloc_steal() now works as it does in current
> > code, although it can certainly leave behind more memory
> > (the whole pool) if used inappropriately.
> My only concern is that it appears that the 'inappropriate' use is
> something that has (for better or worse, and I know there have been
> strong feelings about this in the past) been quite a useful programming
> idiom in Samba4.
It's actually less than a problem than it looks, as you only
keep a reference to a pool if you talloc_steal out of that pool.
The goal is to keep pool usage to a bare minimum (the proposed
use is to create the initial talloc_tos frame in S3 as a pool,
to fast path most of the easy calls), not to make pools common.
talloc_steal (much though I personally don't like it :-) will
remain the more common idiom.
> Otherwise, this looks like a really neat trick, even if it starts down
> the process of running our own malloc... I presume it would also make
> valgrind memory tracking a little harder to figure out.
It is a really neat trick :-). Congratulations to Volker for
writing this, it's a really cool piece of code :-).
More information about the samba-technical