Boost logo

Boost :

Subject: Re: [boost] [pool] Objects of varying sizes
From: Sylvain Bougerel (sylvain.bougerel.devel_at_[hidden])
Date: 2012-05-04 19:44:23

> Is it possible to create a pool for polymorphic types? For example:
> class A;
> class B : public A;
> class C : public A;

Well, if class B and C have additional members (if they are not empty
classes) you will need to use a memory pool that is capable of allocating
varying amount of contiguous memory. I don't see why this is not possible.

Have you looked at Boost.Pool? It uses a free list and allocate varying
amounts of chuncks of memory, based on your request. If you choose an
appropriate size for the small chunk, then you may be able to dynamically
allocate without wasting too much space.


Boost list run by bdawes at, gregod at, cpdaniel at, john at