On Mon, 24 Sep 2001, Brian Pane wrote:

> Is it always going to be true that all the bucket subclasses are declared
> in apr_buckets.h?  If so, how about doing something like this:
>
>   union bucket_size {
>     struct apr_bucket t1;
>     struct apr_bucket_heap t2;
>     struct apr_bucket_pool t3;
>     /* rest of the bucket types omitted for clarity... */
>   };
>
> and using sizeof(union bucket_size) as the single block size for the
> free list?

That's a very good start... the only problem is that we have no way to
know how much space custom bucket types will need.  As long as the space
requirement is "reasonable," I think we should provide for it.  If the
definition of reasonable that we choose is <=sizeof(union bucket_size),
then that's okay with me.  Or maybe it should be the size of the union or,
say, 64B, whichever is bigger?  Should we even bother?

I'm also having trouble coming up with a prototype for apr_bucket_free:
unless you do something magical, you have to pass it the list number:

void apr_bucket_free(void *ptr, int list);

But that means it'll be tricky to support the b->free(b) thing that
FirstBill requested.  It was nice and clean with SMS (grumble), since the
function to use and the particular instance to be freed (and knowledge of
its parent) were tied together as b->sms... any ideas?  I suppose we could
wrap free() with some other function in order to discard the extra
parameter for those bucket types that might still want to use malloc/free
directly... ugh.

--Cliff

--------------------------------------------------------------
   Cliff Woolley
   [EMAIL PROTECTED]
   Charlottesville, VA


Reply via email to