talloc_tos() Re: 617ec07 ?
Volker.Lendecke at SerNet.DE
Wed Aug 11 00:45:08 MDT 2010
On Wed, Aug 11, 2010 at 04:27:00PM +1000, tridge at samba.org wrote:
> I should start off by saying that I think talloc_tos() should
> definately be in common code. It is now used in so much s3 code that
> we have to support it.
> My main confusion with talloc_tos() comes when think about how it
> interacts with async events. With a lot of what happens in Samba now
> happening in callbacks, it isn't clear to me that a stack based
> approach is a good match.
> Is there some way that talloc_tos and events is handled specially so
> it makes sense? For example, what happens to memory allocated in timer
> or signal callbacks? What about protocol callbacks on sockets?
> It may well be handled fine, I don't know of a specific bug related to
> talloc_tos and events, I'm just flagging it as a combination that
> leaves me a bit puzzled.
The rule is pretty simple: Once you leave a routine with
return or at the end of a callback, talloc_tos() will be
automatically be freed. I see it like a C++ destructor that
can be postponed by a few instructions. So for anything that
needs to survive the current callback, talloc_tos() can not
More information about the samba-technical