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();
while (!imglist.isEmpty())
imglist.removeFirst();
while (!reglist.isEmpty())
reglist.removeFirst();
imglist.clear();
reglist.clear();
To copy to clipboard, switch view to plain text mode
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
));
}
for (int i = 0; i < count; i++)
{
reglist[i].translate(-minx, -miny);
imglist[i] = imglist[i].copy(QRect(minx, miny, width, height));
}
To copy to clipboard, switch view to plain text mode
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
));
}
for (int i = 0; i < count; i++)
{
reglist[i]->translate(-minx, -miny);
*imglist[i] = imglist[i]->copy(QRect(minx, miny, width, height));
}
To copy to clipboard, switch view to plain text mode
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.
Bookmarks