13 Jul 09:04
question about garbage collection
From: killian koepsell <koepsell <at> gmail.com>
Subject: question about garbage collection
Newsgroups: gmane.comp.python.ipython.user
Date: 2008-07-13 07:08:33 GMT
Subject: question about garbage collection
Newsgroups: gmane.comp.python.ipython.user
Date: 2008-07-13 07:08:33 GMT
Hi, I noted the following behavior in ipython: If you run the following few lines in ipython, an object is created and destroyed: In [1]: class C(object): ...: def __del__(self): ...: print 'deleting object...' ...: ...: In [2]: obj = C() In [3]: del obj deleting object... The same, of course, works if you run theses line within a script that is called from ipython. If you don't delete the object at the end of the script, it is available afterwards in ipython. For some reason, the object destructor doesn't seem to be called when the object is later deleted. It seems that even after deleting the object, there is still some reference to that object around somewhere. Is this the expected/wanted behavior? Is it possible to force a complete destruction of the object in order to free the used memory? Thanks, Kilian
RSS Feed