[Interest] QPixmapCache considerations on ios and android

maitai maitai at virtual-winds.org
Sun Oct 25 15:53:36 CET 2015


Hello,

I have several relatively big pixmap I'd like to manage through cache. 
Big meaning 1024x1024 at a maximum (one edge is 1024 while the other is 
less or equal). I need to keep something like 10 of those in a cache 
system. Each image being quite heavy to paint, that would help a lot.

I believe each pixmap uses a maximum of 1024 * 1024 * (32 / 8 byte) / 
1024 / 1024 = 4 Mb, right?

QPixmapCache is eating way too much memory for that (40MB + 
"whatever-is-needed-for-qt" on regular memory), on android and 
especially iOS it's a no go. Plus it's kind of shared with qt own needs 
so it's hard to decide which limit to give.

What would you advise? Saving the pixmap on disk, with a "kind of cache" 
system to limit it to a given size, last used is dropped etc? Using 
opengl textures to store/restore img with a similar cache system? Using 
QPixmapCache anyway? Something else?

I should add that in our case it's way faster to read the pixmap from a 
pre-saved png than to re-generate it, and that quality is ok for our 
needs. So a disk-cache might be ok. But 40mb on a mobile device is 
something expensive....

Thanks
Philippe Lelong



More information about the Interest mailing list