I am using VC++ 6.0.
When i clear a vector using vector.clear() the capacity is not being reduced to zero. Hence the memory is not being deallocated.
I have tried to reduce the reserved size by use of vector.clear() followed by vector.reserve(0). This however has no effect. I have also tried swapping it with itself which also has no effect?
Is there a simple, proper way to do this or tell me what I might be doing incorrectly? Thanks!
My code for example:
std::vector<std::vector<CString> > myarray; std::vector<CString> row; row.push_back("stuff"); myarray.push_back(row); myarray.clear(); //Doesnt deallocate the memory myarray.reserve(0); //Doesnt deallocate memory myarray.swap(myarray);//Doesnt deallocate memory