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

[Qt PDF] Memory spikes when zooming into a page that contains a raster image

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.5.5-1, 6.7.0
    • PDF
    • Windows 10 22H2, MSVC 2019 x64

    Description

      Steps to reproduce

      Open Windows Task Manager and keep an eye on the RAM usage while performing this test.

      1. Build and run the "PDF Single Page Viewer Example" https://doc.qt.io/qt-6/qtpdf-singlepage-example.html
      2. Use it to load this test PDF file: https://code.qt.io/cgit/qt/qtwebengine.git/plain/examples/pdf/multipage/resources/test.pdf?h=6.7
      3. Ensure that the 1st page is visible in the viewer (the page with the green Qt logo)
      4. Manually type "2000%" into the Zoom Selector combo box, and wait for the zoomed image to display
      5. Use your mouse cursor to highlight the last digit in Zoom Selector combo box, and then type "1" (to make the value jump to "2001%)
      6. Return to 100% zoom
      7. Increment the Page Selector combo box (the page with text) and repeat Steps #4 - #6
      8. Increment the Page Selector combo box (the page with the vector tiger) and repeat Steps #4 - #6

       

      Outcomes

      Page Baseline RAM at 2000% zoom Behaviour when switching from 2000% to 2001%
      1 (Qt logo) ~580 MB The image disappears for a while, RAM spikes >2x to ~1280 MB, then image reappears, then RAM returns to baseline
      2 (Text) ~710 MB The image disappears for an instant then reappears, RAM always remains around baseline
      3 (Tiger) ~470 MB The image disappears for an instant then reappears, RAM always remains around baseline

       

      Notes

      • The behaviour of Pages 2 and 3 are as expected. For Page 1, it's as if the old image isn't destroyed before the new one is rendered (even though it has already disappeared from the view)
      • It looks like the whole page is rendered at the new zoom level, regardless of the viewport size (Evidence: Panning around the page does not increase RAM consumption). Would it be possible to rasterize/render only a subsection of the page when the viewport is much smaller than the page, to reduce RAM usage?

      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:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes