Boost logo

Boost :

From: jhopkin_at_[hidden]
Date: 2004-07-07 03:48:59


Daniel Frey wrote:
> jhopkin_at_[hidden] wrote:
> > The STL implementation I have been using seems to allocate a buffer on
first
> > insertion into any container of a given type, and frees it only when it
> > feels like it (often on program shut-down).
>
> Sounds like a pool allocator. Question: Does .clear() for your STL
> return the buffer to the pool or is it still bound to the instance? What
> happens in case of the .swap()-trick?

I believe .clear() and the swap trick do what's expected per instance.
Specifically for vector, clear generally won't release any memory to the
pool; the swap trick releases it all.

James Hopkin


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