https://issues.qgis.org/https://issues.qgis.org/favicon.ico2013-05-28T07:22:31ZQGIS Issue TrackingQGIS Application - Bug report #7900: Mass vertex removal with node tool leaks memoryhttps://issues.qgis.org/issues/7900?journal_id=412912013-05-28T07:22:31ZSandro Santillistrk@kbt.io
<ul></ul><p>Gave valgrind a shot. This time I exited edit mode without saving.</p>
11261 789,971 (32 direct, 789,939 indirect) bytes in 1 blocks are definitely lost in loss record 10,522 of 10,523<br />11261 at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br />11261 by 0x6E1424: QgsSelectedFeature::updateGeometry(QgsGeometry*) (qgsselectedfeature.cpp:83)<br />11261 by 0x6E18D1: QgsSelectedFeature::geometryChanged(long long, QgsGeometry&) (qgsselectedfeature.cpp:157)<br />11261 by 0x897D0B: QgsSelectedFeature::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_qgsselectedfeature.cxx:64)<br />11261 by 0x972D280: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.1)<br />11261 by 0x8544610: QgsVectorLayer::geometryChanged(long long, QgsGeometry&) (moc_qgsvectorlayer.cxx:337)<br />11261 by 0x8543E7A: QgsVectorLayer::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_qgsvectorlayer.cxx:185)<br />11261 by 0x972D280: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/x86_64-linux-gnu/libQtCore.so.4.8.1)<br />11261 by 0x8544D52: QgsVectorLayerEditBuffer::geometryChanged(long long, QgsGeometry&) (moc_qgsvectorlayereditbuffer.cxx:164)<br />11261 by 0x81C52AA: QgsVectorLayerUndoCommandChangeGeometry::undo() (qgsvectorlayerundocommand.cpp:169)<br />11261 by 0xA2B05B0: QUndoCommand::undo() (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.1)<br />11261 by 0xA2B0EBE: QUndoStack::setIndex(int) (in /usr/lib/x86_64-linux-gnu/libQtGui.so.4.8.1) QGIS Application - Bug report #7900: Mass vertex removal with node tool leaks memoryhttps://issues.qgis.org/issues/7900?journal_id=412922013-05-28T07:37:12ZSandro Santillistrk@kbt.io
<ul></ul><p>The leak seems unrelated. Instead I found out that if you change selected tool before exiting edit mode, then the leak goes away<br />(but only after exiting edit mode)</p> QGIS Application - Bug report #7900: Mass vertex removal with node tool leaks memoryhttps://issues.qgis.org/issues/7900?journal_id=412932013-05-28T07:38:54ZSandro Santillistrk@kbt.io
<ul></ul><p>Nope, I take it back, there's no direct corrispondence between deselecting the nodetool and the leak. It still sometimes happen and sometime not.</p> QGIS Application - Bug report #7900: Mass vertex removal with node tool leaks memoryhttps://issues.qgis.org/issues/7900?journal_id=413622013-05-29T05:10:46ZSandro Santillistrk@kbt.io
<ul></ul><p>I believe the memory is used by the undo stack as QgsVectorLayerEditUtils only exposes a function to delete a single vertex so it makes a geometry clone for each removed vertex.</p> QGIS Application - Bug report #7900: Mass vertex removal with node tool leaks memoryhttps://issues.qgis.org/issues/7900?journal_id=413672013-05-29T05:49:02ZJürgen Fischerjef@norbit.de
<ul></ul><p>Sandro Santilli wrote:</p>
<blockquote>
<p>I believe the memory is used by the undo stack as QgsVectorLayerEditUtils only exposes a function to delete a single vertex so it makes a geometry clone for each removed vertex.</p>
</blockquote>
<p>On rollback it just reverses each operation on the undo stack one by one - and each vertex removal is one geometry change (QgsVectorLayerUndoCommandChangeGeometry). There doesn't seem to be any rollback optimization for consecutive geometry changes.</p> QGIS Application - Bug report #7900: Mass vertex removal with node tool leaks memoryhttps://issues.qgis.org/issues/7900?journal_id=413682013-05-29T05:52:23ZSandro Santillistrk@kbt.io
<ul></ul><p>Yep, that's what I figured. Let's leave optimization (making multiple-vertices removal a single operation) for ticket <a class="issue tracker-1 status-5 priority-4 priority- closed" href="https://issues.qgis.org/issues/7929" title="Exiting edit mode withouth saving triggers a "geometryChanged" event for each removed vertex (Closed)">#7929</a>.<br />This ticket remains for the memory leak. Haven't checked if the memory in use is still in the undo stack or where else...</p> QGIS Application - Bug report #7900: Mass vertex removal with node tool leaks memoryhttps://issues.qgis.org/issues/7900?journal_id=414232013-05-29T22:15:49ZSandro Santillistrk@kbt.io
<ul><li><strong>Resolution</strong> set to <i>fixed</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p><a class="changeset" href="https://issues.qgis.org/projects/qgis/repository/revisions/59788cb8fcbe86a71397c3046981d00f06c40b00" title="- sync sip binding of QgsVectorLayer - [API] introduce signal QgsVectorLayer::beforeRollBack() - ...">59788cb8fcbe86a71397c3046981d00f06c40b00</a> made this unperceptible (can't see memory growing). So, good job !</p>