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

QNetworkDiskCache can cosume a larger memory in downloading a large file

    XMLWordPrintable

Details

    • Windows

    Description

      • QNetworkDiskCache consumes a larger size of memory comparing to the file size to download. Qt 6 uses almost double of the down load file size.
      • Even when using the cached data, QNetworkDiskCache uses a larger size of memory than the download file size.
      • A user thinks this memory consumption is larger than his expectation considering it is using the cached data on the disk, and he is wondering if this is expected behavior or not. He is pointing out that is caused by the following part of code where the application tries to read all data from the cache into the buffer :
          
        https://codebrowser.dev/qt5/qtbase/src/network/access/qnetworkdiskcache.cpp.html#418

      How to reproduce the issue:

      Run the attached reproducer (untitled14). The application tries to download a linux ISO image, which is 409 MB in size, with using QNetworkDiskCache.

      With Qt 5.15.16, during the first download, the size of memory used by the application was increasing, and it reached up to 454.3 MB when the download was finished.
      For the second run, the download was finished in a moment due to the cache, and the size of memory used was 415.8 MB.

      With Qt 6.6.3, the size of memory used for the first download reached up to 884.9 MB when the download was finished.
      For the second run, the download was finished in a moment, and the application used 517.5 MB memory.

      With Qt 6.7.0, the size of memory used for the first download reached up to 887.1 MB when the download was finished.
      For the second run, the download was finished in a moment, and the sapplication used 519.3 MB memory.

       

      The memory sizes above were checked via Windows Task Manager.

       

      Attachments

        1. screen_shots.zip
          192 kB
        2. untitled14.zip
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            manordheim Mårten Nordheim
            hitoshiito Hitoshi Ito
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes