vector<string> does not clear memory after out of scope
问题 i've encountered the following problem, and i'm not really sure whether i am wrong or its a really weird bug. I fill a huge array of strings and want it to be cleared at a certain point. Here's a minimal example #include <string> #include <vector> #include <unistd.h> //sleep #include <iostream> int main(){ { std::vector<std::string> strvec; for(long i = 0; i < 1000000; ++i){ std::string out = "This is gonna be a long string just to fill up the memory used by this fucking pthread\n"; strvec