[Numpy-discussion] numpy.any oddity

Robert Kern robert.kern@gmail....
Fri Feb 6 14:39:45 CST 2009


On Fri, Feb 6, 2009 at 13:24, Suchindra Sandhu <suchindra@gmail.com> wrote:
> Hi,
>
> I accidently stumbled upon this odd behavior by numpy.any. The following
> code leaks memory -
>
> for i in xrange(10000000):
>         print N.any({'whatever': N.arange(10000000)})
>
> Ofcourse, I called "any" on a dict object by accident, but it should not
> really leak memory.
>
> I am running numpy version 1.0.4 with python 2.5.2

Upgrade to a more recent version of numpy. I do not see a leak. I
vaguely recall there being a problem in the 1.0.x series with
object-dtype scalars, which is what numpy.any() will convert a dict
to.

-- 
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 Numpy-discussion mailing list