talloc_stack.c?
tridge at samba.org
tridge at samba.org
Mon Jul 2 07:36:54 GMT 2007
Volker,
> I would like to set the top of the stack from the topmost
> destructor, but the children's ones are called after it, so
> they would overwrite the top.
I still don't see the problem. Use DLIST_REMOVE() and it will do the
right thing. You can remove in any order you like.
Do you have a snippet of code showing the problem you are thinking of?
> 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.
If there is a loop at one level then the stack idea won't really help
with the peak memory usage (which is really what matters).
If what you really want this for is DEBUG() then maybe a varient of
DEBUG() that allocates a _tmp_ctx would make sense? Eg:
#define DEBUG_TMP_CTX(level, xx) do { \
TALLOC_CTX *_tmp_ctx = talloc_new(NULL); \
DEBUG(level, xx); \
talloc_free(_tmp_ctx); \
} while(0)
then use _tmp_ctx in the debug args.
would that help with the current static string uses?
Cheers, Tridge
More information about the samba-technical
mailing list