<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert Zchn";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        mso-fareast-language:DE-AT;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        mso-fareast-language:DE-AT;}
span.E-MailFormatvorlage19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.HTMLVorformatiertZchn
        {mso-style-name:"HTML Vorformatiert Zchn";
        mso-style-priority:99;
        mso-style-link:"HTML Vorformatiert";
        font-family:Consolas;
        mso-fareast-language:EN-US;}
span.E-MailFormatvorlage22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE-AT" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">Hi Matthias,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">yes, the same with a clean new profile.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">4 iterations per second at the begining, 1 very 6 seconds at the end…
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><QgsMapLayer: 'nix 1 13:08:41' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><QgsMapLayer: 'nix 2 13:08:41' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><QgsMapLayer: 'nix 3 13:08:41' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><QgsMapLayer: 'nix 4 13:08:42' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><QgsMapLayer: 'nix 5 13:08:42' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><QgsMapLayer: 'nix 6 13:08:42' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><QgsMapLayer: 'nix 7 13:08:42' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><QgsMapLayer: 'nix 8 13:08:43' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><QgsMapLayer: 'nix 397 13:25:38' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D"><QgsMapLayer: 'nix 398 13:25:45' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><QgsMapLayer: 'nix 399 13:25:51' (ogr)><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div align="center">
<table class="MsoNormalTable" border="0" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:8.0pt;font-family:"Courier New""><o:p> </o:p></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:8.0pt;font-family:"Courier New""><o:p> </o:p></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span style="font-size:8.0pt;font-family:"Courier New"">QGIS-Version</span><span style="font-size:8.0pt;font-family:"Courier New";mso-fareast-language:DE-AT"><o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">3.12.1-București<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">QGIS-Codeversion<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New""><a href="https://github.com/qgis/QGIS/commit/121cc00ff0">121cc00ff0</a><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Kompiliert gegen Qt<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">5.11.2<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Laufendes Qt<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">5.11.2<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Kompiliert mit GDAL/OGR<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">3.0.4<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Läuft mit GDAL/OGR<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">3.0.4<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Kompiliert mit GEOS<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">3.8.1-CAPI-1.13.3<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Läuft mit GEOS<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">3.8.1-CAPI-1.13.3<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Kompiliert mit SQLite<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">3.29.0<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Läuft mit SQLite<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">3.29.0<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">PostgreSQL-Client-Version<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">11.5<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">SpatiaLite-Version<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">4.3.0<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">QWT-Version<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">6.1.3<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">QScintilla2-Version<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">2.10.8<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Kompiliert mit PROJ<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">6.3.1<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Läuft mit PROJ<o:p></o:p></span></p>
</td>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Rel. 6.3.1, February 10th, 2020<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">BS-Version<o:p></o:p></span></p>
</td>
<td colspan="3" style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Windows 10 (10.0)<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">Aktive Python-Erweiterungen<o:p></o:p></span></p>
</td>
<td colspan="3" style="padding:0cm 0cm 0cm 0cm">
<p style="margin:0cm;margin-bottom:.0001pt;-qt-block-indent:0"><span style="font-size:8.0pt;font-family:"Courier New"">db_manager;
<br>
MetaSearch; <br>
processing<o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:8.0pt;font-family:"Courier New";color:#1F497D;mso-fareast-language:DE-AT"><o:p> </o:p></span></b></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="color:#1F497D;mso-fareast-language:DE-AT"><o:p> </o:p></span></b></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="DE" style="mso-fareast-language:DE-AT">Von:</span></b><span lang="DE" style="mso-fareast-language:DE-AT"> Matthias Kuhn <matthias@opengis.ch>
<br>
<b>Gesendet:</b> Montag, 20. April 2020 12:50<br>
<b>An:</b> Drexel Peter <Peter.Drexel@vorarlberg.at>; qgis-user@lists.osgeo.org<br>
<b>Betreff:</b> Re: [QGIS-Developer] Memory Leak / Slowdown?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>Hi Peter,<span style="font-size:12.0pt;mso-fareast-language:DE-AT"><o:p></o:p></span></p>
<p>Did you try this on a clean new profile with no plugins installed?<o:p></o:p></p>
<p>Bests<o:p></o:p></p>
<p>Matthias<o:p></o:p></p>
<div>
<p class="MsoNormal">On 4/20/20 11:08 AM, Drexel Peter wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-US">Hi,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">I use a Python-Script to load all shapefiles in a directory tree one by one and export the sld-files.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">It works fine, but slows down incredible after ~100 files.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">So I tried the following barebone script with just the essentials  (load shapefile, add it to the map canvas, remove it again and then clear the project) in a loop and I get the same behavior…</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">from datetime import datetime</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">for i in range(1, 1000):</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">                vlayer=QgsVectorLayer ("aShapeFile.shp" ,"run  " + str(i) + " at " + datetime.now().strftime('%H:%M:%S') ,"ogr")</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">                QgsProject.instance().addMapLayer(vlayer)</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">                QgsProject.instance().removeMapLayer(vlayer.id())</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">                QgsProject.instance().clear()</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Same result,  the Script slows down after every iteration in the loop AND QGIS-memory consumption goes up!</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Do I need to do some garbage cleaning / what am I doing wrong / is this a Memory leak?</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Thanks everybody for any hints / help!</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Peter </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;mso-fareast-language:DE-AT"><br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>QGIS-Developer mailing list<o:p></o:p></pre>
<pre><a href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a><o:p></o:p></pre>
<pre>List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><o:p></o:p></pre>
<pre>Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><o:p></o:p></pre>
</blockquote>
</div>
</body>
</html>