Re: MemPools rewrite

From: Andres Kroonmaa <andre@dont-contact.us>
Date: Thu, 19 Oct 2000 09:11:08 +0200

On 18 Oct 2000, at 16:20, Alex Rousskov <rousskov@measurement-factory.com> wrote:
> On Wed, 18 Oct 2000, Andres Kroonmaa wrote:
>
> > search for right pool based on ptr would have much less overhead
> > with chunks than it would be with current Pools. This could even
> > be considered.
>
> Still prohibitively expensive, in general, IMO.

 Not necessarily prohibitively. In my proposed new pooling, we need to
 lookup Chunk where given freed ptr belongs. This is done by traversing
 Pool linkedlist and comparing if given ptr is within bounds of a Chunk.
 This can be easily extended to search all Pools, not only specified,
 and the overhead is not related to the number of objects allocated in
 pools, but only to the number of Chunks. The larger the Chunks, the
 less overhead. It has orders of magnitude less overhead than it would
 take to search and compare all and each pointer.

 I think that we can provide an additional anonymous free function, that
 does exactly this. Normal way of freeing pooled object would be to
 specify a Pool, having minimal overhead, but when it is inconvenient
 to remember Pool, then this searching function could be used.

> > Then it should account for that in sizeof() also, right? But then
> > chunked pools get created with right objsizes also.
>
> If you use the right size/offsets, chunks will work, _provided_ you do
> not prepend each chunk with some housekeeping information of arbitrary
> size. I am not saying you add that information now, but somebody may be
> tempted to do it later.

 yes, this is what needs to be remembered.

> Note that the above requires access to data type at the time of pool
> creation which is a problem if pools as in lib/ (can be solved with
> macros, I guess).

 hmm, caller of poolCreate must know data type sizeof, Pools themselves
 shouldn't care.

------------------------------------
 Andres Kroonmaa <andre@online.ee>
 Delfi Online
 Tel: 6501 731, Fax: 6501 708
 Pärnu mnt. 158, Tallinn,
 11317 Estonia
Received on Thu Oct 19 2000 - 01:14:35 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:51 MST