svn commit: samba r9752 - branches/SAMBA_3_0/source/rpc_server trunk/source/rpc_server

tridge at samba.org tridge at samba.org
Mon Aug 29 23:05:04 GMT 2005


Jerry,

 > | Yes, if you create a tree (as you propose) you can just
 > | steal the top of the tree.
 > 
 > Excellent!  That's what I initially thought, but thought
 > I was wrong.

yep, and this is one of the reasons why its important to think about
the memory hierarchy when using talloc. One thing I've found very
useful is to put in talloc_report_full() calls at some strategic
places when you are first developing a lump of code, then look at the
print out of the hierarchy and see if it matches what you wanted. I've
found quite a few bugs this way.

It's also really useful to use talloc_report_full() from inside gdb. I
commonly put a breakpoint on code I am debugging in gdb, then do:

  gdb> p talloc_report_full(mem_ctx, stdout)

it gives you a quite different perspective on the code than the usual
gdb backtrace, and I often find it allows me to better understand
whats going on (I also call file_save() a lot from inside gdb to dump
a lump of data to a file).

If you want the report in a file, you can do this:

  gdb> p talloc_report_full(mem_ctx, fopen("talloc.dat", "w"))

as long as you don't mind wasting a file descriptor :-)

Cheers, Tridge


More information about the samba-technical mailing list