Closed zhafen closed 7 years ago
Original comment by Zachary Hafen (Bitbucket: zhafen, GitHub: zhafen)
Fixed as of this commit.
This was resolved by locating the objects that lingered in memory, explicitly deleting them with del, and then running gc.collect()
.
Original comment by Zachary Hafen (Bitbucket: zhafen, GitHub: zhafen)
Relevant link on why Python doesn't release memory when a large object is deleted.
Original comment by Zachary Hafen (Bitbucket: zhafen, GitHub: zhafen)
It's possible this memory usage will persist until the process terminates, even if everything is garbage collected properly (as explained here). A potential workaround, which would also speed up the code, is to use Python multiprocessing. I'll try this out, and see what happens!
Original comment by Zachary Hafen (Bitbucket: zhafen, GitHub: zhafen)
I'm using memory_profiler to investigate memory usage.
It looks like my instance of SnapshotIDSelector
isn't being deleted.
Originally reported by Zachary Hafen (Bitbucket: zhafen, GitHub: zhafen)
Running
IDSelector.select_ids()
starting at snapshot 0 down to snapshot 600 crashes with a memory error at snapshot ~120, even on a large memory node.IDSelector.select_ids()
should, at any given time, only use up memory equivalent to at most two snapshots: One for the snapshot the IDs are being selected in and one for the running set of IDs.Update: Multiprocessing didn't seem to solve the issue. Still getting a memory error for loading a single snapshot plus a small set of arrays. Trying to update readsnap now.