Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-21359

QPixmapCache does not appear to respect the cacheLimit

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.8.0
    • 4.7.4
    • None
    • I have seen this on snow leopard and windows 7, I have not tested any other operating systems.
    • 7ab0bed3a56d46c386e65abc381264c57137cb43

    Description

      I am using about 2000 test images with resolution 1024x768(they are the sample pictures that come with windows, I mention this in case there's some dependency on the image size). I load the pixmaps into QPixmapCache using the following code(this is from a minimum compilable example so I'm not storing the key for retrieval):

      QPixmap pixmap(filename);
      QPixmapCache::insert(pixmap);

      When I set cache limit to a small value such as 2048, the memory usage of my application's process is fairly steady and under 20 mb. When I set the cache limit to something higher such as 10240(the default), my application's memory usage shoots to over a gigabyte as all the images are loaded in. Based on the documentation, I do not think that it's supposed to work this way.

      I have attached a minimum(more or less) compilable example of this behavior. To see the behavior click the import button, import a large number of copies of images around 1024x768 in size, and watch the memory usage soar in the task manager.

      Attachments

        1. TestQPixmapCache.zip
          2 kB
          Eric Abbott-Brenner

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              rodal Samuel Rødal
              eabbottbrenner Eric Abbott-Brenner
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes