[Interest] Possible memory leak in QXmlStreamReader

Marc Schmitzer marc.schmitzer at richard-wolf.com
Wed Nov 7 17:07:23 CET 2012


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;
}




-- 
Mit freundlichen Gruessen / 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

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

+++
Richard Wolf GmbH, Pforzheimer Strasse 32, 75438 Knittlingen
Managing Directors: Siegfried Karst, Alfons Notheis. Trade Register: Mannheim HRB 510031
+++
Richard Wolf GmbH routinely monitors the content of e-mail sent and received via its network for the purposes of ensuring compliance with its policies and procedures. Richard Wolf GmbH is not responsible for any changes made to the message after it has been sent. Where opinions are expressed, they are not necessarily those of Richard Wolf GmbH. This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended addressee, or the person responsible for delivering it to them, you may not copy, forward, disclose, or otherwise use it or any part of it in any way. To do so may be unlawful. If you receive this e-mail by mistake, please advise the sender immediately.
+++




More information about the Interest mailing list