You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Melt van Schoor reported a memory leak, illustrated by the following code:
from numpy import *
class Lattice:
def __init__(self, size):
self.size = size
self.lat = empty((self.size, self.size), dtype=object)
for x in range(self.size):
for y in range(self.size):
self.lat[x,y]=Location(self)
# compare with this..
# self.lat=[[Location(self) for y in xrange(self.size)] for x in xrange(self.size)]
class Location(list):
pass
def __init__(self, parent):
self.parent=parent # This line is crucial to triggering the leak
# To trigger, run this (it will consume increasing amounts of memory)
for t in xrange(2000000): Lattice(80)
The text was updated successfully, but these errors were encountered:
Title changed from Memory leak: objects not deallocated after using them in an array to Add cyclic garbage collection support to object arrays by @mwiebe on 2011-03-24
Original ticket http://projects.scipy.org/numpy/ticket/1003 on 2009-02-08 by @stefanv, assigned to unknown.
Melt van Schoor reported a memory leak, illustrated by the following code:
The text was updated successfully, but these errors were encountered: