[Interest] Possible memory leak in QXmlStreamReader

Marc Schmitzer marc.schmitzer at richard-wolf.com
Thu Nov 15 13:01:00 CET 2012


I have further investigated the issue since originally posting this, and 
have found the cause of the problem.

Details can be found at https://bugreports.qt-project.org/browse/QTBUG-27889

Mit freundlichen Grüßen / Best regards

Marc Schmitzer

SW-Entwicklung ESWL / ESWT
Software development ESWL / ESWT

*****************************************************************

Richard Wolf GmbH

Pforzheimer Strasse 32

75438 Knittlingen

Tel.:         +49 7043 35-1107
Fax:          +49 7043 35-1255
Email:        marc.schmitzer at richard-wolf.com
Web:          http://www.richard-wolf.com

*****************************************************************

On 11/07/2012 05:07 PM, Marc Schmitzer wrote:
> Hello everybody,
>
> we discovered a potential memory leak with an (admittedly somewhat
> unusual) use of QXmlStreamReader.
>
> Before reporting this as a bug, I wanted to get some opinions on whether
> this really is a bug or if we're just mis-using the interface.
>
> I've appended a code snippet that triggers the bug. Note that this runs
> a tight loop, so you might want to at a sleep() somewhere to avoid
> stalling your machine.
>
> When run, the virtual image size of the program quickly increases.
>
> Qt version is 4.8.1 as currently provided by ubuntu for the "precise"
> release (4.8.1-0ubuntu4.2), platform is 32 bit Ubuntu 12.04.
>
>
>
> #include <QString>
> #include <QXmlStreamReader>
>
> int main()
> {
>     const QString xml = "<test><foo>bar</foo><bazz>frobozz</bazz></test>";
>
>     QXmlStreamReader stream;
>
>     while (true)
>       {
>         stream.clear();
>         stream.addData(xml);
>
>         while (stream.readNextStartElement())
>       {
>         // NOP
>       }
>       }
>
>     return 0;
> }
>
>
>
>




More information about the Interest mailing list