Destructor never called ???
aleax at aleax.it
Fri Sep 20 02:45:27 EDT 2002
> There are several different issues. First of all, __del__ does not get
> called if an object is destroyed by GC (GC gets used to clean up cyclic
> garbage). Secondly, Jython does not use refcounting; it's pure GC, just
Right, but, I'd put it differently: GC is inhibited from destroying
objects whose types define a __del__ -- rather, it collects them into
gc.garbage, because it can't know that finalizing them is safe. I
find this has a strong inhibitory effect against defining __del__ --
if and when I do, then reference loops become a potential problem
again, i.e., may lead to resource leaks once more.
More information about the Python-list