PDA

View Full Version : QPixmap memory handling



Angelo Moriconi
1st December 2008, 15:37
Hi all !
I'm developing a test program that shown a lot of images, with the possibility to edit them (painting). This program also support layers for each images.
Currently I store images using QPixmap (each layer class have a QPixmap field), but when I load a big project (with 300/400 images each of them could contain more than one layer) this program take 1.2 GB of system memory !!

Each QPixmap is stored in memory and it is not compressed, hence even a 640x480 blank image takes about 1.2 MB of ram.

I have some idea but I don't know the best way to implement using Qt:

A solution could be creating a cache for the QPixmap that store the unused pixmap on disk instead of memory.
Another solution could be store the qpixmap in memory (as now) but compressed.

Anyone have a similar problem ?

Thanks in advance,

Angelo