memory management - C++ vector reduce allocation size -


when c++ vector dynamically reduce allocated size in practice.

i know allocated space doubles upon insert full vector, it's not clear me when allocation reduced. classical hysteresis halve allocation size upon removal 1/4-full vector.

it never shrink allocated memory in absence of explicit direction so.

in c++11 there shrink_to_fit call ask implementation this, may not reduce allocated memory. in prior versions have create new copy , swap away old one.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -