[Numpy-discussion] Memory leak
Pietro Bonfa'
pietro.bonfa at fis.unipr.it
Thu Jun 13 11:06:43 EDT 2013
Upgrading numpy solved the problem!
Thanks!
On 06/13/13 17:06, Sebastian Berg wrote:
> On Thu, 2013-06-13 at 16:50 +0200, Pietro Bonfa' wrote:
>> Dear Numpy users,
>>
>> I have a memory leak in my code. A simple way to reproduce my problem is:
>>
>> import numpy
>>
>> class test():
>> def __init__(self):
>> pass
>>
>> def t(self):
>> temp = numpy.zeros([200,100,100])
>> A = numpy.zeros([200], dtype = numpy.float)
>> for i in range(200):
>> A[i] = numpy.sum( temp[i].diagonal() )
>>
>> return A
>>
>> a = test()
>> c = [a.t() for i in range(100)]
>>
>> Running this script will require 1.5 Gb of memory since the 16 mb of
>> temp arrays are never deallocated.
>>
>> How can I solve this problem?
>>
>
> Please upgrade your Numpy version, there was a problem in diagonal which
> by a lot of bad luck managed to creep into the 1.7.0 version of NumPy.
> And this is quite certainly what you are seeing.
>
> Regards,
>
> Sebastian
>
>> Thanks in advances,
>> Pietro Bonfa'
>>
>>
>> P.S: I asked the same question also on stack overflow
>> (http://stackoverflow.com/questions/17085197/is-this-a-memory-leak-python-numpy
>> )
>>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
--
Pietro Bonfa' - PhD student
Dipartimento di Fisica e Scienze della Terra "Macedonio Melloni"
Viale delle Scienze 7A
43124 Parma - Italy
More information about the NumPy-Discussion
mailing list