A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/312801.html below:

MemoryError Numarray

MemoryError Numarray MemoryError NumarrayRobert Kern rkern at ucsd.edu
Mon Sep 26 03:26:08 EDT 2005
Bernhard Reimar Hoefle wrote:
> I have the following python script:
> #######################################
> from numarray import *
> 
> while 1:
> 	a=arange(1,300000000)
> 	b=a*100/100
> 	del a
> 	del b
> #######################################
> 
> This script crashes after a few minutes with an error:
> 
> MemoryError: Couldn't allocate requested memory
> 
> How can I avoid python to use new memory space for each loop?

It's entirely possible that you're running out of memory *during* the
first loop. The a array takes up over 1Gb by itself. a*100 is a
temporary array that takes another 1Gb, and finally b takes up another
1Gb. So you have over 3Gb that's trying to exist at the same time.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4