From: Michael Marcin (mmarcin_at_[hidden])
Date: 2008-02-08 16:13:15
John Maddock wrote:
> Hervé Brönnimann wrote:
>> 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,
> Or you could use operator::new to construct the container at the start of
> main, and free it before main returns?
> Another 2c, John.
That is possible but does carry a bit more overhead and is the fallback
I'm just wondering if, while using the Boost implementation of unordered
containers something like:
template< typename V, typename H, typename P, typename A >
void purge_memory( unordered_set<V,H,P,A>& c )
unordered_set<V,H,P,A>().swap( c );
would release all the memory.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk