comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Ada containers and custom allocators
Date: Fri, 11 Jan 2008 13:02:24 -0800 (PST)
Date: 2008-01-11T13:02:24-08:00	[thread overview]
Message-ID: <d7aad2ce-9f76-48be-ba75-d7a54836a24f@z17g2000hsg.googlegroups.com> (raw)
In-Reply-To: fm8ebb$q14$1@jacob-sparre.dk

On 11 Sty, 06:00, "Randy Brukardt" <ra...@rrsoftware.com> wrote:

> > It can work -- you just can't take advantage of (say) fixed sized
> > chunks.  I guess what you're saying is that that defeats the main
> > purpose!
>
> The OP claimed that fixed-size allocators could be used, and my lengthy
> reply was intended to rebut that. Surely, they can't be used portably or
> generally.

In Ada, you mean?

In C++ this works by passing the allocator parameter to the template
container class, which in turn can re-bind the allocator to use
whatever size is used internally. This means that the fixed-size
allocator cannot be prepared for only a given allocation size, but
that does not seem to be a problem in practice. The whole point of
using a fixed-size allocator is to enable some specialized allocation
scheme (like bitmap-based management of free blocks) and this is
independent of any given size. In other words, the allocator should be
ready to work with any size, but this is fixed once by the container
itself.
You might say that there is a limitation in that container will have
to use nodes of fixed size, but this, again does not seem to be a
problem - I have never seen a list (for example) that internally uses
nodes of varying sizes.

This works in C++ and gives spectacular performance improvements. It's
a pity Ada does not provide anything in this area.

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com



  reply	other threads:[~2008-01-11 21:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-07 15:48 Ada containers and custom allocators Maciej Sobczak
2008-01-07 16:29 ` Dmitry A. Kazakov
2008-01-08  1:54 ` Randy Brukardt
2008-01-08  7:59   ` Maciej Sobczak
2008-01-08 23:54     ` Randy Brukardt
2008-01-09  8:56       ` Dmitry A. Kazakov
2008-01-09 15:29         ` Robert A Duff
2008-01-09 17:09           ` Dmitry A. Kazakov
2008-01-09 21:58             ` Robert A Duff
2008-01-10 10:12               ` Dmitry A. Kazakov
2008-01-11  5:00           ` Randy Brukardt
2008-01-09 15:28       ` Robert A Duff
2008-01-11  5:00         ` Randy Brukardt
2008-01-11 21:02           ` Maciej Sobczak [this message]
2008-01-11 22:41             ` Robert A Duff
2008-01-12 13:40               ` Maciej Sobczak
2008-01-12 15:59                 ` Robert A Duff
2008-01-09  1:17     ` Jeffrey R. Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox