Max Size of Array when using Numeric.py

Paul F. Dubois dubois1 at llnl.gov
Sat Nov 13 11:42:59 EST 1999


There is no intrinsic limit on the size of NumPy arrays. You just ran out of
memory, I guess.

Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from Numeric import *
>>> a=arange(5500*200)
>>> a.shape
(1100000,)
>>>

5500*200 = 1,100,000 * 4 = ~ 4MB per copy.
You have at least three copies, mv, eval(mv), and the resultant array.
eval(mv) is going to be double sized since the default Python real is 8
bytes. You aren't clear about mv but likely it is more than 4MB too. So
maybe we are pushing 16-20 MB. That doesn't really seem like enough for a
memory error.

You could write a C extension that created the array and did the reading of
each element and placing it into the array so that you only had the one
copy.

Helka FOLCH <helka.folch at edf.fr> wrote in message
news:38286054.C8612EB5 at edf.fr...
> I've tried to create an array object whose shape is (5500,200) but I get
> a memory error. Is there a maximum size for array objects?
>
> Maybe there's a better way of creating the array than what I did :
> My program reads the array which is in another format from a file. It
> transforms the array to the right format and holds it in a variable(mv)
> as a string. Then I just do:
>
> m = array(eval(mv),Float)
>
> Thanks a lot,
> Helka
>






More information about the Python-list mailing list