[QGIS-Developer] Memory Leak / Slowdown?

Matthias matthias at opengis.ch
Mon Apr 20 08:20:50 PDT 2020


Hi Peter,  
  
Happy you found a way.  
  
Can you try proposals number 2 and 3 from my previous email? If they do not help, please open a ticket.  
  
Bests  
Matthias  
  
  
  
  

> Hi Matthias,  
> Thanks to your hints I found a way:  
> The script also works if I do not add the Layer to the Project but directly save the Sld-Style. So I can also skip clearing the QgsProject.instance.  
>    
> vlayer=QgsVectorLayer (pfad ,sfileOhneExt,"ogr")  
> #QgsProject.instance().addMapLayer(vlayer)  
> vlayer.saveSldStyle (sldpfad)  
> #QgsProject.instance().clear()  
>    
> But besides my personal “success”: including the 2 Lines should not lead to rising time /memory consumption or am I wrong?  
> Should I make a ticket?  
>    
> Peter  
>    
>  Hi Peter,  
>    
> It's possible that a part of the cleanup only happens on the next event loop run.  
>    
> Questions / things to try:  
>    
> - Do you really need to add them to the project or is a layer without adding it to the project good enough for your purpose?  
> - Can you run this in batches of ~100 (or even 1) each and then trigger the next batch on a new event loop invocation, e.g. by using QTimer.singleShot()  
> - The easiest thing would be calling QgsApplication.processEvents(), but be warned that using this is known for introducing instabilities, depending on the context in which it is called  
>    
> Matthias  
>    
>    
>    
>  
  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200420/63f751f9/attachment-0001.html>


More information about the QGIS-Developer mailing list