In some cases, memory usage constitutes an issue. For example, if we want to handle a huge number of particles we will have a memory overhead due to the creation of many
memory_profiler summarizes, in a way similar to
line_profiler, the memory usage of the process.
memory_profiler package is also available on the Python Package Index. You should also install the
psutil module (https://code.google.com/p/psutil/) as an optional dependency, it will make
memory_profiler run considerably faster.
memory_profiler also requires the instrumentation of the source code, by putting a
@profile decorator on the function we intend to monitor. In our case, ...