#include "iostream"
#include <list>
typedef std::list<std::string*> STDLIST;
typedef std::list<std::string*>::iterator STDLIST_ITE;
int main()
{
STDLIST *test_list = new STDLIST();
for (int j = 0; j < 100; ++j)
{
for (int i = 0; i < 20000; ++i)
{
std::string *str = new std::string("str");
str->reserve(i);
//delete str;
//str = NULL;
test_list->push_back(str);
}
unsigned int counter = 0;
while (!test_list->empty())
{
++counter;
std::string *ptr = test_list->front();
delete ptr;
ptr = NULL;
test_list->pop_front();
}
std::cout<<"counter="<<counter<<std::endl;
test_list->clear();
if (j%10 == 0)
{
std::cout<<"j="<<j<<",test_list->size="<<test_list->size()<<std::endl;
sleep(1);