Open kushalkolar opened 2 months ago
I just tried running this code in a cell repeatedly:
class Foo:
def __del__(self):
print(f"foo {id(self)} is deleted")
Foo()
Contrary to my assumptions, I do not see the message being printed (It is when I write foo = Foo()
instead, so it's not actually the cell output). Wtf.
Yea I will need to investigate this later, jupyter gc, part 3 :laughing:
Edit: maybe some ideas here to reset the output https://stackoverflow.com/questions/49515085/python-garbage-collection-sometimes-not-working-in-jupyter-notebook
I wonder if it's possible to know when a cell with a plot in the output has been replaced by running the cell again, I think the previous plot(s) still linger in RAM when this happens. I wonder if there's a way in juptyer to capture that a cell has been overwritten so we can close a plot if it's in the output.