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?