std::vector resize downward
Calling resize() with a smaller size has no effect on the capacity of a vector. It will not free memory. The standard idiom for freeing memory from a vector is to swap() it with an empty temporary vector: std::vector<T>().swap(vec);. If you want to resize downwards you’d need to copy from your original vector into a … Read more