
7 Jul
2004
7 Jul
'04
8:48 a.m.
Daniel Frey wrote:
jhopkin@reflectionsinteractive.com 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