1 | initial version |
This is really a question about python memory management. If I'm not mistaken, python may under certain conditions give memory back to the OS, but claiming memory from the OS is quite an expensive operation, so for efficiency reasons, I'd expect python to be rather reluctant at doing so: most of the time it's better to keep a hold of the memory for reuse later.
Another thing to be aware of: just because you delete one reference to the data structure doesn't necessarily imply the data structure can be garbage collected. It could be that the IPython history buffer holds a reference to it or that there's a debugging dataframe lying around that is still referencing the data structure.