talloc_stack.c?
Volker Lendecke
Volker.Lendecke at SerNet.DE
Mon Jul 2 12:04:14 GMT 2007
On Mon, Jul 02, 2007 at 05:36:54PM +1000, tridge at samba.org wrote:
> 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 you have a strict loop then you might want to do
something like
for (i=0; i<1000; i++) {
TALLOC_CTX *frame = talloc_stackframe();
do_something();
talloc_free(frame);
}
The point of the talloc stack is that in the general
non-looping case the code is not cluttered at all and it
correctly cleans up, and if you find peaks it is very easy
to get rid of them.
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20070702/17425966/attachment.bin
More information about the samba-technical
mailing list