Hi!
Can you write up an example using glib with talloc?
Cheers,
-Brian
On Jul 14, 2008, at 5:09 PM, Stewart Smith wrote:
On Mon, 2008-07-14 at 10:48 -0400, Jay Pipes wrote:
Stewart Smith wrote:
On Mon, 2008-07-14 at 00:20 -0700, Brian Aker wrote:
To you does it make sense to have a mashup of glibc and talloc? It
sounds like a mess.
Perhaps we could blend talloc and some of our existing stuff and
end up
with a decent string library..... or, perhaps it is possible to make
glib do talloc, i'd need to look a bit closer.
I answered this in an earlier thread (no pun intended). Yes, it is
absolutely possible. It is done using the g_mem_set_vtable()
function:
http://library.gnome.org/devel/glib/2.16/glib-Memory-Allocation.html#g-mem-set-vtable
This doesn't seem to work too well with a hierarchical memory
allocator
like talloc though.
The main beauty of talloc is that allocations are linked together in a
tree.
So when you say "allocate memory for a connection" every bit of memory
you allocate that's related to that connection, you allocate under the
context of that connection. It's then possible to easily go "here is
all
the memory used by this connection".
It also means that talloc_free(connection) goes and frees all the
memory
for that connection. It makes it *really* hard to get it wrong.
While with glib you still can - you have to manually free everything.
Which is fraught with difficulties. It's also hard to track
allocation.
If we had all allocation done through talloc we could very easily have
an I_S table that listed where all the memory was going for each
connection in the server.... which could be rather powerful/useful.
--
Stewart Smith ([EMAIL PROTECTED])
http://www.flamingspork.com/
--
_______________________________________________________
Brian "Krow" Aker, brian at tangent.org
Seattle, Washington
http://krow.net/ <-- Me
http://tangent.org/ <-- Software
_______________________________________________________
You can't grep a dead tree.
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp