I don't have much experience with QT and this problem came out today.
QList<int> memList;
const int large = 100000;
getchar();
for (int i=0; i<large; i++)
{
memList.append(i);
}
cout << memList.size() << endl;
getchar();
for (int i=0; i<large; i++)
{
memList.removeLast();
}
cout << memList.size() << endl;
getchar();
After first loop when I check memory usage it goes up as new elements are appended to the memList
but after removing them within second loop the memory usage stays at the same level. I thought that QList
was dynamic and it would free memory when element is removed. So either I'm missing something (very probable) or it is not dynamic structure. Do you have any ideas how to make it work?
Regards