Tiny (with respect to memory) Python

jcollins jcollins at boulder.net
Tue Apr 29 23:29:32 CEST 2003

pacquets at newsguy.com wrote:

>I can't find any recent postings about this, so I hope someone can help me out
>I ported 2.0 to our weird little real-time OS awhile ago, and I found the memory
>consumption pretty unacceptable for an embedded device (for our low-end models,
>anyway).  Some stats:
> * enter the interpreter, add two numbers, exit.  High-water mark:  153K
> * enter again, do the following & exit:
>>>>import os
>high-water mark:  850K
>This is not to throw stones;  I think Python's a wonderful language and I'd like
>all our users to have it.  But I really need to bring that number down
>drastically for the low-end products.  I accept that that might require *really*
>draconian measures.  What's the best way to do that?
>Some thoughts:
>1) there is Pippy, which is now on SourceForge and seems pretty well abandoned. 
>I haven't figured out yet what they did to bring the footprint down.
I put a source tar file in the downloads section ("Reduced Python") a 
few weeks ago.  It contains all of the footprint reducing features of 
Pippy, which it turns out can also reduce base heap usage.  Other 
aggressive measures, such as moving dictionaries off  the heap to 
storage memory, running .pyc code directly from storage, etc., aren't 
applicable to the desktop and so aren't included.   Just do a 
./configure --help to display a list of features that may be removed at 
compile time.  FYI, this version of Python is 1.5.2+, just pre-unicode 
so it should be very similar to the 2.0 version.

Jeffery Collins (http://www.boulder.net/~jcollins)

More information about the Python-list mailing list