talloc_stack.c?

Jeremy Allison jra at samba.org
Mon Jul 2 19:14:03 GMT 2007


On Mon, Jul 02, 2007 at 09:15:10AM +0200, Volker Lendecke wrote:
> 
> Sure. But with the talloc stack I want to make that more
> fine grained. For example a routine to handle a single smb
> request might have to do quite a bit of looping, and I want
> to give that routine a chance to clean up memory earlier
> than the main talloc loop would.

I've now had a chance to read through Volkers' code and
I must admit I like the idea - it does provide a standard
way to attach a hierarchy of talloc contexts to a function
without having to code everything up as a linked list.

If we ensuer all exits from the function delete that
talloc stack entry then we're guarenteed to free everything
up before having to go back to the main loop.

I could have used this in the ACL code rewrite I had
to do recently, I ended up having to use the main loop
talloc context instead - which was too long lived for
the purpose.

I'd vote +1 on this idiom.

Jeremy.


More information about the samba-technical mailing list