Brent Dax wrote:

Leopold Toetsch:
# It's totally sane with the standard copying allocator. But the malloc # allocator tracks resources (i.e. strings bufstart) only via # the header. # So, when you reuse the header, the old bufstart which was # there before # is unmanaged and leaks.

Can we add a way to explicitly free the memory associated with a buffer
without freeing the header? That seems like it could be useful in other
areas too (although I'm not quite sure where)

Actually I did remove such a function (string_destroy or so). I don't think that actively freeing resources + DOD/GC would give us any advantage. For strings you would need to different routines already - have a look at headers.c:add_free_buffer():

if (!--(*refcount))
free(refcount); /* the actual bufstart */

So mixing the 2 schemes is a PITA, IMHO.
leo



Reply via email to