Boost logo

Boost :

Subject: Re: [boost] [pool] Objects of varying sizes
From: Robert Dailey (rcdailey.lists_at_[hidden])
Date: 2012-06-26 14:02:53


On Tue, Jun 26, 2012 at 12:48 PM, Cory Nelson <phrosty_at_[hidden]> wrote:

> On Fri, May 4, 2012 at 2:14 PM, Robert Dailey <rcdailey.lists_at_[hidden]
> >wrote:
>
> > Is it possible to create a pool for polymorphic types? For example:
> >
> > class A;
> >
> > class B : public A;
> > class C : public A;
> >
> > I want to create a pool of type A, but the allocation can be for B or C
> at
> > any time. Will this work?
> >
>
> For performance reasons, you'll only be able to allocate objects of a fixed
> size. You might try a pool of variant<B,C> instead.
>
> For a variable-sized pool, as an implementation detail most runtime
> environments do implement a variable-sized pool behind the scenes for
> malloc/new.

So are you saying it isn't beneficial or practical to use boost::pool to
allocate chunks of varying sizes, and that the Windows Memory Manager is
better suited?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk