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

oliver oliver.schoenborn at gmail.com
Thu Sep 8 02:48:11 BST 2016


On Wed, Sep 7, 2016, 19:14 Andreas Pakulat <apaku at gmx.de> wrote:

> Hi,
>
> On Wed, Sep 7, 2016 at 11:57 PM, Xavion <xavion.0 at gmail.com> wrote:
> > So, you're both saying that the following two lines are equivalent (from
> a
> > memory footprint standpoint):
> >
> > from PyQt5.QtCore import QVariant
> > from PyQt5 import QtCore
> >
> > In other words, in both cases, the whole of 'QtCore' will be imported
> > (rather than just 'QVariant' in the first case).


That is correct and same for all python packages/modules not just pyqt

> Florian: I think you're saying that I can reduce the memory usage by doing
> > the following...
> >
> > from PyQt5 import QtCore
> > mVariant = QtCore.QVariant
> > del QtCore
>

Python modules can be unloaded this way but I don't think a DLL gets
unloaded from memory once it is no longer in use by an app. But even if
there was code in the Python interpreter to unload a DLL it would not get
used because the above code will still be holding a reference to a symbol
that is defined in the DLL so the DLL will not be considered unlovable.

Why are you so concerned with memory occupied by modules?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160908/28eb1183/attachment.html>


More information about the PyQt mailing list