Reducing Python's memory footprint?

Joel Hatch joel at
Wed Feb 23 04:37:57 EST 2000


Is there any way to reduce Python's memory footprint? Or maybe to set up
some sort of Python-script server? To get a single copy of Python to
simultaneously interpret several independent scripts?

I've been writing a small Gnome applet, and recently discovered that it
takes up about 5MB of RAM when loaded. Even worse, any other Python
script that I execute takes up about that much more, so when I'm running
four Python scripts, I'm devoting about 20 megs of memory to Python

Using five megs to load a Python interpreter is a little excessive, but
acceptable. Blowing a half of my available RAM on a handful of nifty
panel applets and a monitor or two just doesn't work, though...

As I see it, the problem isn't with the size of the scripts--they're
tiny--it's that I'm loading a new copy of Python every time I execute a
script. How can I tell one copy of Python to run both scripts?

playing with cats

More information about the Python-list mailing list