QGIS Python Memory Release Issue

200 views
Skip to first unread message

Colin Mazengarb

unread,
Aug 18, 2022, 12:31:41 AM8/18/22
to QGIS Australia User Group
Hello All,

my problem: 
I am running a python script in the python console of qgis (3.22), windows 10 OS, 32 Gb ram. 
Script does not address anything within qgis (i.e. no map layers, etc). In fact running it outside of a project.
I am using large numpy arrays to do some cellular automata processing. Script runs well and finishes. My final lines in the code delete the instances of each array. (e.g. Myarray = None, or delete Myarray are the 2 methods I have tried)

However, when I view the windows task manager about 15Gb memory is not released.  This only releases if I close qgis. This is annoying but not fatal.

Does anyone have any suggestions how I can release the memory without closing qgis?

kind regards
Colin

Brad Hards

unread,
Aug 18, 2022, 2:49:33 AM8/18/22
to australian-qg...@googlegroups.com
On Thursday, 18 August 2022 2:31:41 PM AEST Colin Mazengarb wrote:
> However, when I view the windows task manager about 15Gb memory is not
> released. This only releases if I close qgis. This is annoying but not
> fatal.
If you keep running the same application, does it increase? If not, I wouldn't
worry.

> Does anyone have any suggestions how I can release the memory without
> closing qgis?
I'd run it in a separate window / python instance. If you are not using
anything in QGIS, just run it from the command line.

If you don't want to do that, consider using gc.collect().
https://docs.python.org/3/library/gc.html

Brad



Colin Mazengarb

unread,
Aug 19, 2022, 6:45:35 PM8/19/22
to australian-qg...@googlegroups.com
Thanks Brad,
Will explore your suggestions shortly. Just need to call the qgis python specifically as this is the only way i can access numpy. Our corporate firewall prevents me from using a stand alone python install.
Cheers
Colin

--
You received this message because you are subscribed to the Google Groups "QGIS Australia User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to australian-qgis-use...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/australian-qgis-user-group/5860096.lOV4Wx5bFT%40audax.
Reply all
Reply to author
Forward
0 new messages