Boost logo

Boost :

Subject: Re: [boost] Proposal: Monotonic Containers
From: Christopher Jefferson (chris_at_[hidden])
Date: 2009-06-10 10:52:15


On 10 Jun 2009, at 15:21, Ion Gaztañaga wrote:

> Christopher Jefferson wrote:
>
>> Out of interest, which set of extensions did you add to DLmalloc?
>> Would be nice to try to come up with a small, consistant working
>> set, to then try to sell to some mallocs.
>
> See http://www.drivehq.com/web/igaztanaga/allocplus/#NewFunctionsForExpansion
>
> Code is here:
>
> http://www.drivehq.com/web/igaztanaga/allocplus.zip

Thanks!

No offence, but while that method is good as it is as general as
possible, it perhaps doesn't look very "C-like", and is maybe too
complex to try to pursade them to add.

How important is backward expansion, and try_shrink_in_place? While
obviously these things are useful, do you think they are "vital"? I'm
interested as you have clearly written a lot of code which uses these
mechanisms.

My thought is that adding a function which is exactly "realloc, except
don't move, just return", with the option to try to get as much memory
as possible, say:

int realloc_try(void* ptr, size_t size, size_t* new_size)

With the same semantics as relloc except it doesn't move, and if it
can do a partial expansion (or shrink) tries to do as much as it can
and returns the new size in new_size, is (from looking at source) a
very easy addition to many mallocs, and less invasive.

Chris


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