Memory problem

"Martin v. Löwis" martin at v.loewis.de
Mon Aug 14 18:40:44 EDT 2006


Yi Xing wrote:
> Thanks! I just found that that I have no problem with
> x=[[10.0]*2560*2560]*500, but x=range(1*2560*2560*30) doesn't work.

That's no surprise. In the first case, try

x[0][0] = 20.0
print x[1][0]

You have the very same (identical) list of 2560*2560 values in x
500 times.

To create such a structure correctly, do

x = [None] * 500
for i in range(500)
  x[i] = [10.0]*2560*2560

In any case, check ulimit(1).

Regards,
Martin



More information about the Python-list mailing list