JeanC
1st September 2008, 10:07
Hello,
My program uses 2 QList's for it's task.
When it is done it goes idle untill the next task, there I try to clean up:
while (!imglist.isEmpty())
imglist.removeFirst();
while (!reglist.isEmpty())
reglist.removeFirst();
imglist.clear();
reglist.clear();
But it looks likes the memory is not being freed, top reports a whopping 45 mb still in use.
I tried to use the lists with delete and new but I couldn't find the right syntax.
In stead of
for (int i = 0; i < count; i++)
{
reglist[i].translate(-minx, -miny);
imglist[i] = imglist[i].copy(QRect(minx, miny, width, height));
}
Use something like:
for (int i = 0; i < count; i++)
{
reglist[i]->translate(-minx, -miny);
*imglist[i] = imglist[i]->copy(QRect(minx, miny, width, height));
}
I tried various versions with at() and [] but kept getting errors. :(
I am most curious though to why it is not releasing all that memory in the first place.
Thanks.
My program uses 2 QList's for it's task.
When it is done it goes idle untill the next task, there I try to clean up:
while (!imglist.isEmpty())
imglist.removeFirst();
while (!reglist.isEmpty())
reglist.removeFirst();
imglist.clear();
reglist.clear();
But it looks likes the memory is not being freed, top reports a whopping 45 mb still in use.
I tried to use the lists with delete and new but I couldn't find the right syntax.
In stead of
for (int i = 0; i < count; i++)
{
reglist[i].translate(-minx, -miny);
imglist[i] = imglist[i].copy(QRect(minx, miny, width, height));
}
Use something like:
for (int i = 0; i < count; i++)
{
reglist[i]->translate(-minx, -miny);
*imglist[i] = imglist[i]->copy(QRect(minx, miny, width, height));
}
I tried various versions with at() and [] but kept getting errors. :(
I am most curious though to why it is not releasing all that memory in the first place.
Thanks.