memory_profiler
Let's talk about memory_profiler and how it helps.
Another great 3rd party profiling package is memory_profiler. The
memory_profiler module can be used for monitoring memory consumption in a process or we can use it for a line-by-line analysis of the memory consumption of our code. Since it’s not included with Python, we’ll
have to install it.
Getting started
We can use pip for this:
pip3 install memory_profiler
Once it’s installed, we need some code to run it against. The memory_profiler actually works in much the same way as line_profiler in that when we run it, memory_profiler will inject an instance of itself into _builtins_ ...