How do I set the perfect QPixmapCache :: cacheLimit?

I just started using QPixmapCache and I was wondering as there is not much documentation on how to adjust the size based on the system the application is running on.

Some users may have a lot of free memory, while others may have very little. I have no idea what the best setting would be.

What would be the best way to detect system (free) RAM and adjust the cache size accordingly?

http://doc.trolltech.com/4.4/qpixmapcache.html#setCacheLimit

0


source to share


2 answers


To find free RAM in Windows, you can use the GlobalMemoryStatus function .



I'm not sure if the pixmap cache size will help you; you may need to do some performance measurements and create a lookup table.

+1


source


Note that QPixmap is window system specific. This means that QPixmap probably matches graphics card memory more than total RAM. Like any other cache, its size should be "whatever it may be, but no more."



The best way to configure the cache is to profile your application running on a regular machine (target users). See if the cache starts deleting old bitmaps and gets cache gaps.

0


source







All Articles