Forked repo from https://github.com/fabianp/memory_profiler