rootpy.memory.deletion.monitor_deletion

rootpy.memory.deletion.monitor_deletion()[source]

Function for checking for correct deletion of weakref-able objects.

Example usage:

monitor, is_alive = monitor_deletion()
obj = set()
monitor(obj, "obj")
assert is_alive("obj") # True because there is a ref to `obj` is_alive
del obj
assert not is_alive("obj") # True because there `obj` is deleted