Tiny (with respect to memory) Python

pacquets at newsguy.com pacquets at newsguy.com
Tue Apr 29 13:17:12 EDT 2003


I can't find any recent postings about this, so I hope someone can help me out
here:

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
>>> os.listdir('.') 

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.

2) Minimal Python looks promising, but it doesn't seem like they're very far
along yet.

3) Question:  Is there some way to get an idea where the memory is going?  I
found this:

http://www.nightmare.com/medusa/memory-leaks.html

the function at the end of that looks sort of promising;  is that the best way?





More information about the Python-list mailing list