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

QByteArray + QString reserves memory beyond 32-bit limits when growing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 6.5.2
    • Core: Other
    • None
    • WebAssembly

    Description

      I'm using file I/O in a WASM environment and encounter that QByteArray reserves too much memory. This results in not being able to use QByteArrays which are bigger than 550MB as this will reserve a >2GB section of memory internally.

       

      Example:

      Opening a file of 512MB with QFileDialog::getOpenFileContent works, but allocates around 1GB of memory (which can be reduced with squeeze()-ing of course).

       

      Opening a file of 550MB with QFileDialog::getOpenFileContent causes a crash.

       

      File handling is now limited to the unintended (and excessive) allocation of the QByteArray...

      Attachments

        1. Schermafdruk van 2023-08-24 13-43-24.png
          Schermafdruk van 2023-08-24 13-43-24.png
          255 kB
        2. qarraydata.cpp
          9 kB
        3. main-1.cpp
          0.8 kB
        4. Schermafdruk van 2023-08-22 08-52-04.png
          Schermafdruk van 2023-08-22 08-52-04.png
          161 kB
        5. main.cpp
          0.3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            michal Michal Klocek
            pckoster Paul Koster
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes