My python plugin for QGIS 2.18 opens files with millions of features. To convert them in Qgis readable format, I run through several external python libs, one of them is a R-Tree tool, consuming 10G of RAM. Then I create a memory layer and add a million points or triangles. All intermediate steps and their variables are useless now and can be deleted. So far so good.

But if I remove the layer (or all layers completely) the RAM is still full, even after deactivating / reloading the plugin! Even after using "del(biggest_RAM_eating_variables)" or gc.collect().

RAM is only freed after stopping QGIS itself. The problem doesn't occur with the reader outside of QGIS.

  • Any ideas how to cleanup the RAM during QGIS runtime?
  • Or any ideas what might be the real problem?
  • Or how to run the plugin in an external, killable thread?

closed as off-topic by PolyGeo Jan 15 at 11:09

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What library do you use for the rtree? Seems like this is where the issue lies. – ndawson Jan 15 at 9:48