Manually prompting garbage collection
fredrik at pythonware.com
Thu Jul 17 02:39:32 CEST 2008
Fredrik Lundh wrote:
> Do these objects have direct references to a resource that you're
> explicitly destroying from your C code?
and yes, if this is the problem, the correct solution is to create an
separate object type that's designed to manages the resource and act as
a proxy against it, and then let all operations against the resource
(from other objects) go via the proxy.
never let more than one object "own" an external resource.
if you need to explicitly kill the external resource, design the proxy
so you can tell it to ignore (or reject) any subsequent calls to the
resource from other parts of the program.
More information about the Python-list