[Python-Dev] Memory usage in Python

M.-A. Lemburg mal@lemburg.com
Mon, 13 Sep 1999 12:27:04 +0200


Ivan Porres wrote:
> 
> Dear all,
> 
> I've been reading this list for a while but this is the first time I
> post a message. I am interested on using Python as a scripting
> language for small embedded systems. One of the limiting factors on a
> embedded system is the memory. Memory cost money, uses space and
> drains power.
> 
> We have released a big patch to selectively disable some features of a
> Python interpreter at compile time. With the patch, it is possible to
> disable, i.e., complex numbers or file objects, in order to reduce
> the memory foot print of the Python interpreter. The patch is
> available at http://www.abo.fi/~iporres/python
> 
> Now, I am interested on studying and reducing the memory consumption of
> Python programs. That is all the memory allocated by the interpreter
> in order to run a python program. I would like to know if somebody
> else has been working on the same direction. Is there any document
> explaining how Python uses the memory? I would be nice to know which
> structures are most used, their size, how often are accessed,
> etc...

You should have a look at Vladimir Marangozov's pymalloc (hope this
URL still works):

	http://sirac.inrialpes.fr/~marangoz/python/
 
It has some logging facilities which give detailed reports about
the storage sizes etc.

> I have the impression that most people is concerned about optimising
> Python for speed, but I still think that some Python users will
> also benefit from size optimisations.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   109 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/