[Qgis-user] [QGIS-Developer] Memory Leak / Slowdown?

Matthias Kuhn matthias at opengis.ch
Mon Apr 20 03:50:09 PDT 2020


Hi Peter,

Did you try this on a clean new profile with no plugins installed?

Bests

Matthias

On 4/20/20 11:08 AM, Drexel Peter wrote:
>
> Hi,
>
> I use a Python-Script to load all shapefiles in a directory tree one 
> by one and export the sld-files.
>
> It works fine, but slows down incredible after ~100 files.
>
> 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…
>
> from datetime import datetime
>
> for i in range(1, 1000):
>
> vlayer=QgsVectorLayer ("aShapeFile.shp" ,"run  " + str(i) + " at " + 
> datetime.now().strftime('%H:%M:%S') ,"ogr")
>
> QgsProject.instance().addMapLayer(vlayer)
>
> QgsProject.instance().removeMapLayer(vlayer.id())
>
> QgsProject.instance().clear()
>
> Same result,  the Script slows down after every iteration in the loop 
> AND QGIS-memory consumption goes up!
>
> Do I need to do some garbage cleaning / what am I doing wrong / is 
> this a Memory leak?
>
> Thanks everybody for any hints / help!
>
> Peter
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200420/0170ffc4/attachment.html>


More information about the Qgis-user mailing list