hmm.. Re: talloc issues

Sam Liddicott sam at liddicott.com
Tue Jul 28 09:20:39 MDT 2009


* Volker Lendecke wrote, On 28/07/09 16:16:
> On Tue, Jul 28, 2009 at 03:47:05PM +0100, Sam Liddicott wrote:
>> I mean that when talloc_free was understood to remove the most recent
>> parent, it was used liberally.
>>
>> If talloc_free means to remove only the allocating parent then it should
>> almost never be used, and those that took references should release
>> references.
>>
>> Many uses of talloc_free should be talloc_unreference. Talloc_free
>> should only exist in functions intended to take ownership; but this is
>> not the case hence the difficulty in fixing up existing code.
>>
>> My answer is to stop using talloc_free except in cases where you can
>> prove it is safe, but tridge has found cases where it looked safe but
>> wasn't.
> 
> Sorry, I'm lost here. If talloc_free is deprecated, 

It's not.

It's just been used so much on purpose to "get rid of random latest
parent" and these uses need to be removed.

I confused you because I always speak with samba4 hat on, sorry.

> I think
> Samba3 needs to create its own copy of talloc, this time
> without talloc_reference. This pattern (talloc/talloc_free)
> has burnt itself so deeply into my mind that I am just too
> old to give it up again.

me too. It's like wall-papering hell. We shouldn't even be here - but we
are and we're trying to find a sane way out.

> I would consider myself not the dumbest programmer on earth,
> but if talloc is usable only by people way smarter than I am
> (Tridge, Metze and you obviously fall into that category), I
> think something is deeply wrong. What used to be a simple
> hierarchial allocator with destructors has become something
> that my limited mind is just not able to understand. From
> what I've learned over the years I've done programming is
> that abstractions should be simple and code that requires
> comments is inherently fishy. Talloc definitely has lost
> this simplicity for its users, and for me the culprit is
> talloc_reference.

Yes.

My proposal makes talloc sane but seems to irrepairably break samba4.

Sam


More information about the samba-technical mailing list