Is there a memory profiler for python2.7?
I needed to check the memory stats of objects I use in python. I came across guppy and pysizer, but they are not available for python2.7. Is there a memory profiler available for python 2.7? If not is there a way I can do it myself? You might want to try adapting the following code to your specific situation and support your data types: import sys def sizeof(variable): def _sizeof(obj, memo): address = id(obj) if address in memo: return 0 memo.add(address) total = sys.getsizeof(obj) if obj is None: pass elif isinstance(obj, (int, float, complex)): pass elif isinstance(obj, (list, tuple, range)