What did you expect?
You are creating 10,000,000 streams, and adding them all to a list:
list<string> l1;
for(int i=0;i<10000000;++i)
{
stringstream ss;
ss << "000000000000000" << i << "__" << i << "00000000000000000000";
l1.push_back(ss.str());
}
Even if you clear the list when you are finished with it, the streams are still in existence, and the memory they took up will not be released until they all go out of scope - which is when the function ends. See here:
Resource acquisition is initialization - Wikipedia[
^]