line-by-line or named variable memory profiling in python

Viewed 85

I am looking for a memory profiler which shows memory usage per line or per variable.

I tried with memory-profiler, which shows memory usage per line but the problem is it does not work in ipython environment.

I tried pympler, which have a track_class and track_object function. But they can not track variable type like list or dict but predefined class or object. While trying to track list, I got following error:

TypeError: cannot create weak reference to 'list' object

I tried objgraph, which shows the type of variables but not pin point the variable. So there may be several list, but show output like this:

objgraph.show_growth(limit=3) 
tuple                  5228     +5228
function               1330     +1330
wrapper_descriptor      967      +967 

How can I track variables (not predefined class object) or show memory usage per line in ipython environment?

0 Answers
Related