今回は memory_profiler というモジュールを使ってプログラムのメモリ使用量を調べる方法について紹介する。 pypi.python.org このブログでは、以前に Python のプロファイラとして profile/cProfile や line_profiler について書いたことがある。 これまでに紹介したこれらのプロファイラは、主に時間計算量の調査が目的となる。 それに対して memory_profiler では、調べる対象は空間計算量となる。 blog.amedama.jp blog.amedama.jp 使った環境は以下の通り。 $ sw_vers ProductName: Mac OS X ProductVersion: 10.12.6 BuildVersion: 16G1212 $ python --version Python 3.6.4 下準備 まずは mem