|
From: Bart V. A. <bar...@gm...> - 2008-03-24 19:16:45
|
Please ignore the proposal below -- shortly after I wrote down this proposal, I found a way to implement the desired functionality without changing the core. Bart. On Mon, Mar 24, 2008 at 7:56 PM, Bart Van Assche <bar...@gm...> wrote: > Hello, > > VG_(OSetGen_Create)() has four arguments, where the last two are > pointers to an allocation and a deallocation function. These last two > functions are not only used to allocate and deallocate tree nodes, but > also for allocating and deallocating the OSet itself. I'd like to > build an OSet with tree nodes that store a pointer to a > reference-counted bitmap, with a deallocation function that does not > only deallocate the node memory but also decrements the reference > count. It would be inelegant to make the allocation and deallocation > functions try to figure out what kind of item (node or OSet) they are > allocating or deallocating. One solution it to change the OSet > implementation such that it always uses VG_(malloc) / VG_(free) for > the OSet, another solution is to add an extra OSet creation function > that accepts six arguments instead of four (where the two extra > arguments are pointers to the allocation and deallocation function for > the OSet itself). |