How much memory
if pmap's size is 600 x 800; depth is 24;
Does it take
600 * 800 * (32/ 8 byte) / 1024 / 1024 = 1.83 Mega bytes ?
I think so, yes.
Afaik it's not compressed. What could be is that it uses 24 bit and not 32 per pixel, but i'm not sure about that.
A pixmap is not compressed in memory (uncompressing them for each time they need to be drawn would be way too slow), so yes, it takes to full space to store everything you need, and possibly more for padding.
Lesson to take home: don't try to allocate ridiculously large images (neither in a QPixmap, nor in a QImage, for that matter).
Thanks Gerolf and Andre.
One more questions about the QPixmap memoery.
QPixmap mm(800, 600); // ~ 1.83M
I then resize it using the Qt 4 recommendation method.
mm = QPixmap(0,0);
How about the old 1.83M memory. Does Qt recycle it for me or I need to do something
to avoid memory leaks.
Qt will release it at the appropriate time. When that is, could depend on the backend implementation for QPixmap that you are using. However: it is not something for you to worry about, normally.