In [1]: class T(object):
...: pass
...:
In [2]: x = T()
In [3]: print(x)
<__main__.T object at 0x03328E10>
In [4]: x = T()
In [5]: print(x)
<__main__.T object at 0x03345090>
When is the memory location allocated to the first T()
object (0x03328E10) freed? Is it when the variable x
is overwritten or when the garbage collector is ran or when the script ends?
I'm assuming it's when the garbage collector runs but I don't know how to test that assumption.