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

Memory leak in QXmlStreamReader

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.1.0
    • 4.8.1, 5.0.0 Beta 2
    • Core: Other
    • None

      When repeatedly using the same QXmlStreamReader instance to read xml documents by calling addData() and clear(), the memory consumption grows with every iteration.

      I've pinpointed the problem to the tagStackStringStorage member of QXmlStreamReaderPrivate, which is inherited from QXmlStreamPrivateTagStack.

      When you run the attached program in a debugger, you can see that stream.d_ptr.d->tagStackStringStorage.d->alloc continues to grow.

      I suspect this could be fixed by adding tagStackStringStorage.clear() to QXmlStreamReaderPrivate::init(), but I have not tested that.

        1. qxmlstream_memleak.cpp
          0.6 kB
          Marc Schmitzer
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            nierob Nierob
            mschmitzer Marc Schmitzer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes