talloc()
Luke Kenneth Casson Leighton
lkcl at samba.org
Tue Jan 4 15:43:49 GMT 2000
On Wed, 5 Jan 2000, Andrew Tridgell wrote:
> > i don't know if you want to consider adding a reference count system, but
> > it might help.
>
> If you can tell me how to do it while maintaining our current
> interfaces then I would be interested. Remember, we don't have a
> garbage collector and we can't do one in C (no, I don't want to start
> using C++ in Samba).
neither do i :)
> I don't see how to ref count memory without adding code at all the
> points you would need a free if you just used malloc/free. Think about
> the lp_string() case and how it is currently used.
*thinks*.
ok, the default would be that you don't use taddref() or trelease().
then, the garbage collector would trash anything you used if you hadn't
locked it.
however, if you _knw_ it's going to be around for a bit longer, e.g it's
going to be used in one place, idle for a bit, and then used somewhere
else, they you call taddref() on it, go into the idle loop, use the memory
somewhere, then call trelease(), go into the idle loop and_ then_ it gets
trashed.
so, you don't _need_ to call taddref(), which makes it something to
consider.
just an idea.
More information about the samba-technical
mailing list