talloc()

Luke Kenneth Casson Leighton lkcl at samba.org
Tue Jan 4 13:29:29 GMT 2000


On Tue, 4 Jan 2000, Andrew Tridgell wrote:

> > if you can create a talloc(MEMORY_STORE *store, size_t size),and provide
> > MEMORY_STORE *init_talloc(), free_talloc(MEMORY_STORE *store) as
> > base-level functions, then i can use it to trash locally-malloced memory
> > on a per-function call basis, without having to worry about memory leaks
> > and per-msrpc-function-call specific freeing routines.
> 
> yep, thats basically what I had in mind, exccept that I was going to
> have a couple of global memory stores for specific purposes, not
> associated with a particular object. These would get freed up in the
> main idle loops.

microsoft haa memory system where you can addref / release things.  they
then maintain a reference count.  when the reference count is zero, you
can clean-up.

i don't know if you want to consider adding a reference count system, but
it might help.

then again, if you addref too many times and don' release enough times,
the memory sticks around for ever.... not necesarily a good idea!



More information about the samba-technical mailing list