Update on Memory problem with NumPy arrays

Robert Kern robert.kern at gmail.com
Wed Jun 21 14:57:11 EDT 2006


sonjaa wrote:
> Hi
> 
> last week I posted a problem with running out of memory when changing
> values in NumPy arrays. Since then I have tried many different
> approaches and
> work-arounds but to no avail.
> 
> I was able to reduce the code (see below) to its smallest size and
> still
> have the problem, albeit at a slower rate.

Please post this to numpy-discussion instead of here. Also, please create a
ticket in our Trac:

  http://projects.scipy.org/scipy/numpy

> The problem appears to come
> from changing values in the array. Does this create another reference
> to the
> array,	which can't be released?

Since the array shouldn't be going away and no new arrays should be created that
wouldn't cause a problem.

It's possible that there is a bug with the scalar objects that are being created
when indexing into the arrays. I can reproduce abnormal memory consumption even
when I remove the line where you are setting value in the if: clause.

> Also, are there other python methods/extensions that can create
> multi-deminsional
> arrays?

A few. numpy's predecessors, Numeric and numarray are still usable, but aren't
being actively developed. There's a pure-Python array package somewhere, but I
forget the name.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list