memory usage

Dave jaguar4096 at yahoo.com
Fri Dec 5 23:20:17 EST 2003


Hi,
I'm writing code which deals with lists of millions to tens of
millions of
elements.  It seems to me that python gobbles up memory faster than it
should in these cases.

For example, I start the python interpreter and then execute the
following code:

>>> f = []
>>> for i in range(1e7):
...    f.append(0.1)

In another window on my Linux system I then run top.  The python
process is now using 155 MB of memory.  Why is python using such a
large amount of memory, nearly nearly 16 bytes for a float in this
case?




More information about the Python-list mailing list