Boost logo

Boost :

Subject: Re: [boost] Proposal: Monotonic Containers
From: Christopher Jefferson (chris_at_[hidden])
Date: 2009-06-09 08:13:08


On 9 Jun 2009, at 12:56, Christian Schladetsch wrote:

> Hello,
>
> I agree that it is a little inconvenient, but:
>
> Click on the link, open, and open "index.html"
>
> I guess you expected a personally hosted site. I do not run a personal
> website, so I can't post things locally. If there is a better way of
> doing
> it, please advise.
>
> Christian.
>

Very interesting. I have been working on a similar, but much more
limited, proposal which just does this for vector.

I decided I had to implement a new class, because building on top of
the 'allocator' framework wasn't sensible, because you waste too much
buffer space. For example, I believe your example won't work. I'd be
interested to see what you think.

Consider your example, in g++ (which I know how it operates internally)

boost::monotonic::inline_storage<100*sizeof(Object)> storage; //
create local storage on the stack boost::monotonic::vector<Object>
deathrow(storage); // create a std::vector that uses this storage
foreach (object in world)
  { if (IsDead(object)) deathrow.push_back(object); // allocation is
just advancing a pointer }

This will build a vector which will continuously expand, through sizes
1,2,4,8,16,32. At each step, it will allocate a new block of memory
and free the old one, making the storage size 1,3,7,15,31,63. When we
try to push_back beyond 32 elements, the next allocation will overflow
the buffer.

Am I missing something?

Chris

> On Tue, Jun 9, 2009 at 11:46 PM, Thorsten Ottosen <
> thorsten.ottosen_at_[hidden]> wrote:
>
>> Christian Schladetsch skrev:
>>
>>> Hello,
>>>
>>> I have added a few pages of documentation, with motivational
>>> examples, to
>>> a
>>> new upload at
>>>
>>> http://www.boostpro.com/vault/index.php?action=downloadfile&filename=MonotonicAllocator_dox.zip&directory=&
>>>
>>>
>> That is not what I asked for. I wanted online docs and code. We are
>> very
>> busy people, and anything that takes extra time is likely to mean
>> we don't
>> bother.
>>
>>
>> -Thorsten
>> _______________________________________________
>> Unsubscribe & other changes:
>> http://lists.boost.org/mailman/listinfo.cgi/boost
>>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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