Issue
I run a cell in my IPython notebook and python3's memory usage goes up by ~100MB. After I run it again, python3's memory usage again goes up by ~100MB. After a few runs, my computer has run out of memory and programs are crashing.
I can fix this by resetting the IPython kernel, but then I lose the state of my entire notebook. Is there a way to clear the memory used by that particular cell when I re-run the cell, so that old runs don't just accumulate until my computer crashes?
Solution
Adding import gc; gc.collect()
to the beginning of my cell solves the issue.
Answered By - histrionics
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.