I'm currently working on an image processing script which is eating up a lot of memory, and I'm curious about which parts of the script are using up the largest part of the memory, so that I can optimise those parts in order to save on total memory usage (and therefore being able to process larger images).
However, there are a lot of different clauses and different processing functions being called within my script, which makes it hard to keep track of all of the variables that are currently allocated some (or a lot of) memory. I've already made it so several functions get called as a newly spawned process (using multiprocessing
), in order to ensure they don't leave behind any of their variables after running. However, I'm still seeing a lot of memory being used in some situations, and I'd like to be able to pin-point which variables are taking up the largest amount of space.
I hope it's possible to somehow get a report of the used memory. I wouldn't mind having to install some additional packages to make this possible.