How can I determine where memory is being used in a python script
I have a function that does some processing on a very large 3D image. It is part of a snakemake workflow that processes hundreds of these images in parallel. I’m running into a bottleneck with this particular step of the workflow because while running it will consume 25-30% of RAM (reported by top) so I can only run 3 parallel processes. However, when I try to use a Jupyter notebook to determine what steps are consuming so much memory, it never uses more than 5% of RAM. I’m very confused why the memory usage is so different when this code is run from a jupyter notebook vs. the command-line, and I’m not sure how I can approach figuring out what is using so much memory.