Is there any way to manually remove an object which the garbage collection refuses to get rid of even when I call gc.collect()
? Working in Python 3.0
If the GC is refusing to destroy it, it's because you have a reference to it somewhere. Get rid of the reference and it will (eventually) go. For example:
myRef = None
Keep in mind that GC may not necessarily destroy your object unless it needs to.
If your object is holding resources not under the management of Python (e.g., some trickery with C code called from Python), the object should provide a resource release call so you can do it when you want rather than when Python decides.