I am using Memory Profiler module to get the memory usage of my python code following this answer. However, I am not able to interpret the output from %memit
magic (or the output using the @profile
decorator from the module or mprof run
for that matter).
For instance,
%memit range(10000)
gives me peak memory: 97.41 MiB, increment: 0.24 MiB
while,
%memit xrange(10000)
shows peak memory: 97.46 MiB, increment: 0.00 MiB
. I do understand the difference between xrange
returning an xrange type
as opposed to range()
returning a list. I used them here just to demonstrate the two scenarios.
My question is
- What does
peak memory
andincrement
actually mean? - What should I report as the total memory usage of a script (or a function) from this output?