[Marble-devel] Review Request: Fix memory leak in OverviewMap

Bernhard Beschow bbeschow at cs.tu-berlin.de
Wed Apr 11 14:33:16 UTC 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104536/#review12324
-----------------------------------------------------------

Ship it!


Nice to see the memory leak fixed.

Seems to work for me.

- Bernhard Beschow


On April 10, 2012, 4:05 p.m., Jens-Michael Hoffmann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104536/
> -----------------------------------------------------------
> 
> (Updated April 10, 2012, 4:05 p.m.)
> 
> 
> Review request for Marble.
> 
> 
> Description
> -------
> 
>     Sometimes the config dialog was passed as parent widget, sometimes not. In
>     combination with the empty destructor this led to a memory leak. In addition
>     it makes no sense to have the config dialog as parent for the svg widgets, as
>     their relationship is more peer or cousin like.
>     
>     This fixes:
>     ==1364== 8,176 bytes in 1 blocks are possibly lost in loss record 7,992 of 8,032
>     ==1364==    at 0x4029A32: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>     ==1364==    by 0x6D7759A: qRealloc(void*, unsigned long) (qmalloc.cpp:65)
>     ==1364==    by 0x6DE4B18: QVectorData::reallocate(QVectorData*, int, int, int) (qvector.cpp:74)
>     ==1364==    by 0x7809EDC: QVector<QPainterPath::Element>::realloc(int, int) (qvector.h:481)
>     ==1364==    by 0x78120B8: QVector<QPainterPath::Element>::append(QPainterPath::Element const&) (qvector.h:549)
>     ==1364==    by 0x783FBBE: QPainterPath::lineTo(QPointF const&) (qpainterpath.cpp:690)
>     ==1364==    by 0x893831C: QPainterPath::lineTo(double, double) (qpainterpath.h:305)
>     ==1364==    by 0x89293E0: parsePathDataFast(QStringRef const&, QPainterPath&) (qsvghandler.cpp:1630)
>     ==1364==    by 0x8930B1E: createPathNode(QSvgNode*, QXmlStreamAttributes const&, QSvgHandler*) (qsvghandler.cpp:2882)
>     ==1364==    by 0x8935ABF: QSvgHandler::startElement(QString const&, QXmlStreamAttributes const&) (qsvghandler.cpp:3640)
>     ==1364==    by 0x8935199: QSvgHandler::parse() (qsvghandler.cpp:3559)
>     ==1364==    by 0x8935050: QSvgHandler::init() (qsvghandler.cpp:3539)
>     
>     ==1364== 203,178 (224 direct, 202,954 indirect) bytes in 1 blocks are definitely lost in loss record 8,021 of 8,032
>     ==1364==    at 0x4029447: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>     ==1364==    by 0x8930B28: createPathNode(QSvgNode*, QXmlStreamAttributes const&, QSvgHandler*) (qsvghandler.cpp:2884)
>     ==1364==    by 0x8935ABF: QSvgHandler::startElement(QString const&, QXmlStreamAttributes const&) (qsvghandler.cpp:3640)
>     ==1364==    by 0x8935199: QSvgHandler::parse() (qsvghandler.cpp:3559)
>     ==1364==    by 0x8935050: QSvgHandler::init() (qsvghandler.cpp:3539)
>     ==1364==    by 0x8934B3D: QSvgHandler::QSvgHandler(QIODevice*) (qsvghandler.cpp:3516)
>     ==1364==    by 0x894F49D: QSvgTinyDocument::load(QString const&) (qsvgtinydocument.cpp:187)
>     ==1364==    by 0x89534E6: bool loadDocument<QString>(QSvgRenderer*, QSvgRendererPrivate*, QString const&) (qsvgrenderer.cpp:317)
>     ==1364==    by 0x8952CBE: QSvgRenderer::load(QString const&) (qsvgrenderer.cpp:343)
>     ==1364==    by 0x89527AE: QSvgRenderer::QSvgRenderer(QString const&, QObject*) (qsvgrenderer.cpp:140)
>     ==1364==    by 0x8953E53: QSvgWidget::QSvgWidget(QString const&, QWidget*) (qsvgwidget.cpp:107)
>     ==1364==    by 0x1E96B943: Marble::OverviewMap::loadPlanetMaps() (OverviewMap.cpp:456)
>     
>     ==1364== 204,330 (16 direct, 204,314 indirect) bytes in 1 blocks are definitely lost in loss record 8,023 of 8,032
>     ==1364==    at 0x4029447: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>     ==1364==    by 0x8953E3D: QSvgWidget::QSvgWidget(QString const&, QWidget*) (qsvgwidget.cpp:107)
>     ==1364==    by 0x1E96B943: Marble::OverviewMap::loadPlanetMaps() (OverviewMap.cpp:456)
>     ==1364==    by 0x1E96D064: Marble::OverviewMap::updateSettings() (OverviewMap.cpp:375)
>     ==1364==    by 0x1E96D483: Marble::OverviewMap::qt_metacall(QMetaObject::Call, int, void**) (OverviewMap.moc:92)
>     ==1364==    by 0x6EA058D: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) (qmetaobject.cpp:237)
>     ==1364==    by 0x6EB50A9: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3280)
>     ==1364==    by 0x511E4A4: Marble::RenderPlugin::settingsChanged(QString) (RenderPlugin.moc:125)
>     ==1364==    by 0x1E96DAEB: Marble::OverviewMap::setSettings(QHash<QString, QVariant> const&) (OverviewMap.cpp:332)
>     ==1364==    by 0x430384: Marble::MarblePart::readPluginSettings() (marble_part.cpp:1641)
>     ==1364==    by 0x4317E9: Marble::MarblePart::readSettings() (marble_part.cpp:558)
>     ==1364==    by 0x433316: Marble::MarblePart::MarblePart(QWidget*, QObject*, QList<QVariant> const&) (marble_part.cpp:170)
>     
>     ==1364== 584,202 (96 direct, 584,106 indirect) bytes in 3 blocks are definitely lost in loss record 8,027 of 8,032
>     ==1364==    at 0x402994D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>     ==1364==    by 0x6D7755B: qMalloc(unsigned long) (qmalloc.cpp:55)
>     ==1364==    by 0x6DA0EB4: QHashData::allocateNode(int) (qhash.cpp:175)
>     ==1364==    by 0x8951D21: QHash<QString, QSvgNode*>::createNode(unsigned int, QString const&, QSvgNode* const&, QHashNode<QString, QSvgNode*>**) (qhash.h:543)
>     ==1364==    by 0x8951569: QHash<QString, QSvgNode*>::insert(QString const&, QSvgNode* const&) (qhash.h:761)
>     ==1364==    by 0x89501CD: QSvgTinyDocument::addNamedNode(QString const&, QSvgNode*) (qsvgtinydocument.cpp:355)
>     ==1364==    by 0x8947D8F: QSvgStructureNode::addChild(QSvgNode*, QString const&) (qsvgstructure.cpp:107)
>     ==1364==    by 0x8935B66: QSvgHandler::startElement(QString const&, QXmlStreamAttributes const&) (qsvghandler.cpp:3650)
>     ==1364==    by 0x8935199: QSvgHandler::parse() (qsvghandler.cpp:3559)
>     ==1364==    by 0x8935050: QSvgHandler::init() (qsvghandler.cpp:3539)
>     ==1364==    by 0x8934B3D: QSvgHandler::QSvgHandler(QIODevice*) (qsvghandler.cpp:3516)
>     ==1364==    by 0x894F49D: QSvgTinyDocument::load(QString const&) (qsvgtinydocument.cpp:187)
>     
>     ==1364== 1,234,990 (160 direct, 1,234,830 indirect) bytes in 2 blocks are definitely lost in loss record 8,028 of 8,032
>     ==1364==    at 0x402994D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>     ==1364==    by 0x6D7755B: qMalloc(unsigned long) (qmalloc.cpp:55)
>     ==1364==    by 0x6DE4ABC: QVectorData::allocate(int, int) (qvector.cpp:67)
>     ==1364==    by 0x6EB9808: QVector<QObjectPrivate::ConnectionList>::malloc(int) (qvector.h:393)
>     ==1364==    by 0x6EB889F: QVector<QObjectPrivate::ConnectionList>::realloc(int, int) (qvector.h:466)
>     ==1364==    by 0x6EB75FC: QVector<QObjectPrivate::ConnectionList>::resize(int) (qvector.h:331)
>     ==1364==    by 0x6EAEC1B: QObjectPrivate::addConnection(int, QObjectPrivate::Connection*) (qobject.cpp:347)
>     ==1364==    by 0x6EB3EDD: QMetaObjectPrivate::connect(QObject const*, int, QObject const*, int, int, int*) (qobject.cpp:2919)
>     ==1364==    by 0x6EB348C: QObject::connect(QObject const*, char const*, QObject const*, char const*, Qt::ConnectionType) (qobject.cpp:2590)
>     ==1364==    by 0x8953EB2: QSvgWidget::QSvgWidget(QString const&, QWidget*) (qsvgwidget.cpp:109)
>     ==1364==    by 0x1E96B943: Marble::OverviewMap::loadPlanetMaps() (OverviewMap.cpp:456)
>     ==1364==    by 0x1E96D064: Marble::OverviewMap::updateSettings() (OverviewMap.cpp:375)
> 
> 
> Diffs
> -----
> 
>   src/plugins/render/overviewmap/OverviewMap.cpp 80b4efb 
> 
> Diff: http://git.reviewboard.kde.org/r/104536/diff/
> 
> 
> Testing
> -------
> 
> Ran Marble under valgrind with switching between all map themes.
> 
> 
> Thanks,
> 
> Jens-Michael Hoffmann
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20120411/7cd9f06e/attachment.html>


More information about the Marble-devel mailing list