[SciPy-user] Memory quirk
Anand Patil
anand.prabhakar.patil at gmail.com
Fri Nov 2 20:03:25 EDT 2007
Hi all,
The following script leaks memory when an array with dtype=object is used
instead of a list. Is this a bug, or a behavior I should be expecting? Any
help is much appreciated.
Thanks,
Anand
from numpy import *
import time
import gc
class MyObject(object):
def __init__(self):
self.data = zeros(100000, dtype=float)
# This leaks memory...
self.stufflist = array([self], dtype=object)
# This doesn't
# self.stufflist = [self]
for i in xrange(10000):
q=MyObject()
time.sleep(.01)
gc.collect()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20071102/cf47a0e8/attachment.html>
More information about the SciPy-User
mailing list