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

PdfMultiPageView: Very poor memory performance when zooming in/out of long documents

    XMLWordPrintable

Details

    • 8787c5329 (dev), ea6970657 (6.5), 7d09b40b7 (6.6), c6cda495c (dev), 8289e5935 (dev), bd0158ff2 (6.6), 62face924 (6.5), 66d7a5b2b (6.6), c871a52f9 (dev), 2b031670c (6.5), 3df72c56e (dev), 2e5632058 (6.6), 31946b66c (6.5), 96e682217 (dev)

    Description

      Steps to reproduce

      1. Download this file to disk: https://www.st.com/resource/en/reference_manual/rm0433-stm32h742-stm32h743753-and-stm32h750-value-line-advanced-armbased-32bit-mcus-stmicroelectronics.pdf (it is a 40MB, 3300+ page document)
      2. Launch a system memory monitoring tool (e.g. Task Manager on Windows, `top` on Linux)
      3. Launch the PDF Multipage Viewer Example (https://doc.qt.io/qt-6/qtpdf-multipage-example.html )
      4. Click the "Open" button and open the PDF file downloaded above
      5. Use the SpinBox to jump to page 3000
      6. Click the "Zoom In" button 3x
      7. Click the "Zoom Out" button 3x
      8. Click the "Open" button and open the "test.pdf" from the example's source folder

       

      Outcomes

      Using Qt 6.5.1 on Windows 10 22H2, MSVC 2019 x64, Release build:

      Step No. RAM consumed (GB)
      3 0.0
      4 0.5
      5 0.5
      6 3.7 → 7.9 → 13.0
      7 17.0 → 17.9 → 18.4
      8 18.4

       

      Notes

      • For reference, repeating the test above on my dedicated PDF viewer application results in a maximum RAM consumption of 0.2 GB (that's a ~90x difference)
      • The magnitude of this problem seems to be proportional to the page number where we perform the zoom. If I change Step #5 to jump to p1000 instead, the RAM consumption is (1.6 → 3.0 → 4.9 GB) while zooming in, and (6.2 → 7.2 → 7.2 GB) while zooming out. Does PdfMultiPageView render everything from the start up to the page that we're on when zooming?
      • Step #8 does not release memory. I would've expected it to release most of it.
      • With each zoom in the test above, the view jumps by several hundred pages too. I would've expected it to stay on the current page.

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              skoh-qt Sze Howe Koh
              Votes:
              3 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are 7 open Gerrit changes