2015-10-25 15:53 GMT+01:00 maitai <[email protected]>: > 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....
If you used a disk cache with PNG files, the images would be compressed, so probably a lot less than the 4 MB per image you calculated above. I guess you could also try to make a compressed in-memory cache. Cheers, Elvis > > Thanks > Philippe Lelong > _______________________________________________ > Interest mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
