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

QXmlStreamReader - High Memory Consumption with QByteArray

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.1
    • 4.6.1, 4.6.2, 4.6.3
    • None
    • c7fcd56bd3e150e57230ea1445bf4286b3f3fabe

    Description

      When using a QXmlStreamReader with a QByteArray as input, the whole QByteArray gets copied internally when calling QXmlStreamReader::readNextStartElement() for the first time.

      This is a very serious issue when using big input xml data (> 50 MB).

      The QByteArray gets copied in:

      ushort QXmlStreamReaderPrivate::getChar_helper() { // ...
         // line 1526
        decoder->toUnicode(&readBuffer, rawReadBuffer.data(), nbytesread);
      }
      

      My suggestion is to use:

        decoder->toUnicode(&readBuffer, rawReadBuffer.constData(), nbytesread);
      

      instead. QSharedDataPointer should not copy the byte array then.

      Parsing without copying is quite crucial for our application.

      Attachments

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

        Activity

          People

            phartman Peter Hartmann (closed Nokia identity) (Inactive)
            fvielhauer Florian Vielhauer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes