memory leak problem with arrays
Serge.Orlov at gmail.com
Thu Jun 15 00:01:44 CEST 2006
> I'm new to programming in python and I hope that this is the problem.
> I've created a cellular automata program in python with the numpy array
> extensions. After each cycle/iteration the memory used to examine and
> change the array as determined by the transition rules is never freed.
> I've tried using "del" on every variable possible, but that hasn't
Python keeps track of number of references to every object if the
object has more that one reference by the time you use "del" the object
is not freed, only number of references is decremented.
Print the number of references for all the objects you think should be
freed after each cycle/iteration, if is not equal 2 that means you are
holding extra references to those objects. You can get the number of
references to any object by calling sys.getrefcount(obj)
More information about the Python-list