[PyQt] Reducing Ram Usage Tips?

Darryl Wallace darryl.wallace at prosensus.ca
Fri Mar 13 14:44:33 GMT 2009


Hello Stan

stan wrote:
> On Fri, 2009-03-13 at 09:37 -0400, Darryl Wallace wrote:
>   
>> Hello,
>>
>> I've recently developed a data analysis program using PyQt.  It's not a 
>> huge program but it's not small either.  I've noticed that, in Windows, 
>> the memory usage at startup is ~80MB.  I've removed all of the 'import 
>> *'s that I previously had and do not load the Qt module at any location.
>>
>> I am packaging the entire library in the exe using py2exe.
>>
>> Just wondering if anyone else has had any success bringing down the 
>> memory consumption.
>>
>> Thanks,
>> Darryl
>>
>>     
> While there are a great number advantages to having a nice single
> "huge" .exe, memory consumption is driven up as that entire .exe has to
> be loaded in memory at one time, of course.  With the "one directory"
> option in PyInstaller or py2exe, the .exe's themselves are quite small
> by comparison, so that loading and speed generally are much faster out
> of the gate as they make system calls "as needed"; of course memory
> usage will then increase "as needed", but in general, memory use seems
> to remain much smaller.  Of course, the "initial" distribution directory
> is often bigger (a "one timer", usually), but later I have found that
> simple updates, bug fixes, etc. don't require many additional dirctory
> items (of course this depends on what you later add!), but total
> subsequent distribution time is greatly simplified and is limited to the
> new .exe and the simple occasional additions.
>   
Ok that's one of the things that  I thought regarding the single 'exe' 
file. 
> Did you happen to avoid using the QTCore4.dll and QtGui4.dll? (you
> mentioned not having loaded the Qt modules) Can these be avoided in
> favor of the PyQt dll's??  Those are very large, but I think they must
> be always and unavoidably pulled in by PyQt??
>   
 From what I've read and my experience you cannot avoid including the Qt 
dll's.  While they're "very large" relatively speaking, my entire 
program approaches a 21 MB zipped download; acceptable as far as I'm 
concerned.

Darryl


More information about the PyQt mailing list