[PyQt] Attempting to reduce the memory footprint of my PyQt5 application

Kovid Goyal kovid at kovidgoyal.net
Thu Sep 15 07:13:50 BST 2016


That seems highly unlikely, and I cannot reproduce it on my Arch Linux
system, with the following script:

import psutil
import subprocess
import time
import gc
import os

p = psutil.Process(os.getpid())
print(p.memory_info())

while True:
    subprocess.check_output(['true'])
    time.sleep(1)
    gc.collect(), gc.collect(), gc.collect()
    print(p.memory_info())

Output memory usage stays constant after the first two iterations.

Kovid.

On Thu, Sep 15, 2016 at 02:48:23PM +1000, Xavion wrote:
> >
> > Use subprocess? Simpler code and no leaks.
> >
> > subprocess.check_output([command] + args)
> >
> 
> I had a feeling someone would tell me to do that :-).
> 
> Believe it or not, the same problem happens with the 'subprocess' module.
> As such, I have just opened a ticket <http://bugs.python.org/issue28165> on
> the Python bug tracker.
> 
> I guess this news pretty much gets Qt and PyQt off the hook.  I'm sure you
> guys are pleased about that :-).

> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt


-- 
_____________________________________

Dr. Kovid Goyal 
http://www.kovidgoyal.net
http://calibre-ebook.com
_____________________________________


More information about the PyQt mailing list