MemoryError when list append... plz help

James Mills prologic at
Wed Dec 31 07:23:49 CET 2008

On Wed, Dec 31, 2008 at 4:17 PM, James Mills
<prologic at> wrote:
> I have no idea how many bytes of memory
> storing each element of a list consumes
> let alone each float object, but I assure you
> it's not going to be anywhere near that of
> 60494500 4-bytes spaces (do floats in C
> normally consume 4 bytes) in C.

Just creating a list of this many elements
consumes 60% of my desktops RAM.
YOu _SHOLD NOT_ be doing this.

>>> L = list(xrange(N))
>>> len(L)
>>> L[10000]

ps stats:

32351 jmills    20   0  962m 610m 1356 S  0.0 60.6   0:03.36 python

It takes several seconds to create this list
and several minutes for the Python interpreter
to shutdown and deallocate all the memory.


More information about the Python-list mailing list