[SciPy-user] Another memory quirk

Anand Patil anand.prabhakar.patil@gmail....
Fri Nov 2 20:40:23 CDT 2007


Hi all,

Not sure if this is related to my last post but the script below leaks
memory like mad... PLEASE DON'T RUN IT, I don't want to be responsible for
crashing your computer!

Is there any safe way to store a ravelled view of an array in a subclass
like this? I'm using the ravelled view inside a very tight loop & would
rather not spend time calling ravel() if possible.

Many thanks in advance,
Anand


from numpy import *
from PyMC import *

class MyArray(ndarray):
    pass

for i in xrange(1000):

    A=zeros((1000,1000),dtype=float)

    A = A.view(MyArray)

    # If I uncomment this and run it, a huge memory leak ensues.
    # A._ravelled = A.ravel()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071102/ad846aec/attachment.html 


More information about the SciPy-user mailing list