[Qt-qml] Valgrind and QML applications
mikko.kiilholma at nokia.com
mikko.kiilholma at nokia.com
Sat Jan 8 14:58:26 CET 2011
I created a report for this: QTBUG-16526
-----Original Message-----
From: qt-qml-bounces+mikko.kiilholma=nokia.com at qt.nokia.com [mailto:qt-qml-bounces+mikko.kiilholma=nokia.com at qt.nokia.com] On Behalf Of Kiilholma Mikko (Nokia-MS/Tampere)
Sent: 07.01.2011 11:02
To: artur.souza at openbossa.org
Cc: qt-qml at trolltech.com
Subject: Re: [Qt-qml] Valgrind and QML applications
Hi,
A collague of mine found a solution that removes the Valgrind errors in question. The leak appears everywhere in the qt-components-symbian test applications but also e.g. with declarative/minehunt demo application. Below is a clip of an output of the running of the demo (clicking couple of squares and exit the demo).
==7059== 324 bytes in 81 blocks are definitely lost in loss record 448 of 565
==7059== at 0x4025024: operator new[](unsigned int) (vg_replace_malloc.c:258)
==7059== by 0x41E291A: QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus>::SimpleList(int) (qdeclarativeengine_p.h:201)
==7059== by 0x41DD7E2: QDeclarativeVME::run(QDeclarativeVMEStack<QObject*, 128>&, QDeclarativeContextData*, QDeclarativeCompiledData*, int, int, QBitField const&) (qdeclarativevme.cpp:168)
==7059== by 0x41DD36A: QDeclarativeVME::run(QDeclarativeContextData*, QDeclarativeCompiledData*, int, int, QBitField const&) (qdeclarativevme.cpp:110)
==7059== by 0x41D2674: QDeclarativeComponentPrivate::begin(QDeclarativeContextData*, QDeclarativeEnginePrivate*, QDeclarativeCompiledData*, int, int, QDeclarativeComponentPrivate::ConstructionState*, QBitField const&) (qdeclarativecomponent.cpp:775)
==7059== by 0x41D255F: QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData*, QBitField const&) (qdeclarativecomponent.cpp:756)
==7059== by 0x41D2280: QDeclarativeComponent::beginCreate(QDeclarativeContext*) (qdeclarativecomponent.cpp:699)
==7059== by 0x418B99C: QDeclarativeVisualDataModel::item(int, QByteArray const&, bool) (qdeclarativevisualitemmodel.cpp:1053)
==7059== by 0x418B30F: QDeclarativeVisualDataModel::item(int, bool) (qdeclarativevisualitemmodel.cpp:946)
==7059== by 0x4175FEA: QDeclarativeRepeater::regenerate() (qdeclarativerepeater.cpp:332)
==7059== by 0x4175D1F: QDeclarativeRepeater::componentComplete() (qdeclarativerepeater.cpp:295)
==7059== by 0x41D2B1B: QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate*, QDeclarativeComponentPrivate::ConstructionState*) (qdeclarativecomponent.cpp:855)
The correction trial...:
If the following lines in QDeclarativeVME::run()
if (bindValues.count)
ep->bindValues << bindValues;
if (parserStatus.count)
ep->parserStatus << parserStatus;
are changed to these
if (bindValues.count)
ep->bindValues << bindValues;
else
QDeclarativeEnginePrivate::clear(bindValues); // Make sure allocated list is freed even if no items were added in it
if (parserStatus.count)
ep->parserStatus << parserStatus;
else
QDeclarativeEnginePrivate::clear(parserStatus); // Make sure allocated list is freed even if no items were added in it
the leaking does not occur anymore.
- Mikko
-----Original Message-----
From: ext Artur Souza (MoRpHeUz) [mailto:artur.souza at openbossa.org]
Sent: 07.01.2011 01:52
To: Kiilholma Mikko (Nokia-MS/Tampere)
Cc: qt-qml at trolltech.com
Subject: Re: [Qt-qml] Valgrind and QML applications
Hi Mikko,
On Fri, Jan 7, 2011 at 3:27 AM, <mikko.kiilholma at nokia.com> wrote:
> I used to use Valgrind with Qt applications succesfully to detect leaks.
kudos for you :) It's great to see that people still care about the code they write!
> I am asking this because the tool finds so many leaks in many
> applications and they are not the kind of leaks that occurs only once
> in a lifetime of application.
> I am using Valgrind 3.5.0 with Qt4.7.1.
Could you please attach the output of valgrind or even a simple example so I can try to reproduce it here?
> For example in struct SimpleList in qdeclarativeengine_p.h there is an
> array allocated but it is not always deleted and running a repetitive
> case seems to increase the leak count.
At first I would say that this sounds bad. Let's try to take a look at it ;) Please, share your test case (as simple as possible).
Cheers!
--
-------------------------------------------------------
Artur Duque de Souza
openBossa
INdT - Instituto Nokia de Tecnologia
-------------------------------------------------------
Blog: http://blog.morpheuz.cc
PGP: 0xDBEEAAC3 @ wwwkeys.pgp.net
-------------------------------------------------------
_______________________________________________
Qt-qml mailing list
Qt-qml at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml
More information about the Qt-qml
mailing list