Boost logo

Boost :

From: Hervé Brönnimann (hervebronnimann_at_[hidden])
Date: 2008-02-07 23:23:16


Michael: If you are allocating your container before main, you must
know how much memory is needed at compile time, don't you? Can't you
reserve that memory statically (e.g. a char buffer[SIZE]) and use an
arena allocator for your statically created container? This goes for
any container, not just the unordered ones. Just my $.02,

--
Hervé Brönnimann
hervebronnimann_at_[hidden]
On Feb 7, 2008, at 7:10 PM, Daniel James wrote:
> On 07/02/2008, Michael Marcin <mmarcin_at_[hidden]> wrote:
>> I'm on a platform where no memory can be dynamically allocated before
>> main and all dynamically allocated memory must be released before  
>> main
>> returns. Is there a way to ensure this behavior with boost's  
>> unordered
>> containers if they have static duration?
>
> No, there isn't, which is pretty much what you'd expect from the
> standard. Although, I think it is possible to do without breaking the
> standard. I'm not sure if 'clear' can free all memory though, as I'm
> sure if it can change the bucket count.
>
> I'm not sure about this. I initially started to write a fairly
> negative reply, but as I thought it through I realised that it might
> be pretty cheap to implement and might be desirable on other platforms
> as well. Is this a common requirement?
>
> Of course, it's also possible to use the preprocessor to only support
> this on certain platforms, but that could cause maintenance problems
> so I wouldn't want to do that.
>
> I'll think about it some more.
>
> Daniel
> _______________________________________________
> 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