I'm trying to debug why one of my objects is not being garbage collected, and I have several questions from trying to go through documentation/previous questions:
1) If my object is not involved in any reference cycles, am I right that garbage collection does not get involved, and that Python simply frees the memory when the object's reference count drops to 0?
2) When the reference count of such a simple object reaches 0, is the memory freed immediately, and if not, is there a way to force it to be freed?
3) Is Python using sys.getrefcount(obj) to keep track of reference counts?
4) Why doesn't the code snippet below increase the number of referrers from 1 to 2 (it prints 1 both times)?
import gc a = [] print(len(gc.get_referrers(a)) b = a print(len(gc.get_referrers(a))