“
Refer back to Using memory_profiler to Diagnose Memory Usage for a reminder on how to use memory_profiler; here we load it as a new magic function in IPython using %load_ext memory_profiler. Example 11-1. Measuring memory usage of 100,000,000 of the same integer in a list In [1]: %load_ext memory_profiler # load the %memit magic function In [2]: %memit [0]*int(1e8) peak memory: 790.64 MiB, increment: 762.91 MiB
”
”
Micha Gorelick (High Performance Python: Practical Performant Programming for Humans)