[Numpy-discussion] Memory leak in numpy?

Chris Laumann chris.laumann at gmail.com
Sun Jan 26 03:04:37 EST 2014


Hi all-

I think I just found a memory leak in numpy, or maybe I just don’t understand generators. Anyway, the following snippet will quickly eat a ton of RAM:

P = randint(0,2, (20,13))

for i in range(50):
    for ai in ndindex((2,)*13):
        j = P.dot(ai)


If you replace the last line with something like j = ai, the memory leak goes away. I’m not exactly sure what’s going on but the .dot seems to be causing the memory taken by the tuple ai to be held.

This devours RAM in python 2.7.5 (OS X Mavericks default I believe), numpy version 1.8.0.dev-3084618. I’m upgrading to the latest Superpack (numpy 1.9) right now but I somehow doubt this behavior will change.

Any thoughts?

Best, Chris

-- 
Chris Laumann
Sent with Airmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140126/bc8383b8/attachment.html>


More information about the NumPy-Discussion mailing list