Memory usage problems with imports and python

arobinson Andrew.RW.Robinson at gmail.com
Tue Feb 12 11:32:04 EST 2008


I am a developer relatively new to python and brand new to pygtk
development. I wanted to write a bloglines tray icon notifier for my
linux box. Everything is working quite well functionality wise, but
the memory footprint is horrible.

This little tray icon that simply has a thread for updates, a
gtk.StatusIcon, a few relatively small dict objects and a context menu
is running at around 20-25 MB of memory.

Doing some initial research, starting python up takes 1 MB, importing
GTK bumps it up to 4 MB, importing other libraries jumps up to 7 MB
and so on. IMO this code should take up a maximum of 2-4 MB (based on
other linux tray icons and docking programs).

Is this a problem with (a) python, (b) poor memory management of the
python libraries I am using, especially py/gtk or (c) something I am
doing wrong as a developer?

For anyone who wants to help, the code is open source and can be
viewed here:

http://pybloglines.svn.sourceforge.net/viewvc/pybloglines/

The "PyBloglinesNotifier" file is the main python program and imports
code from within the bloglines folder.

Thank you,
Andrew



More information about the Python-list mailing list