QT's bugs #01
Here's a bug in QT's QPixmap class that might confuse a little bit. I only tested this on Symbian plattform (Nokia N8 on the device itself).
screenshot = QPixmap::grabWindow(QApplication::desktop()->winId());
screenshot.scaled(QSize(64,32),Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
qimg = new QImage(screenshot.toImage());
If i called this 3 lines about 15 times (no matter when) I got an "out of memory" message from QImage class. After a bit of investigation and searching for a solution i've found a workaround for this problem.
The error was not created by how i created the QImage but by scaling the QPixmap! On Symbian I had over 101 mb free ram and over 10 mb free vram, so a lack of free memory is not the cause. The easiest way to prevent this memory leak is to convert the QPixmap first to QImage and then scale it to desired size:
screenshot = QPixmap::grabWindow(QApplication::desktop()->winId());
qimg = new QImage(screenshot.toImage().scaled(QSize(128,128),Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
Now the memory error never showed up. I hope this helps out a bit because i've seen a few similar posts on web.