memory - python- how to display size of all variables -


i want print memory size of variables in scope simultaneously.

something similar to:

for obj in locals().values():     print sys.getsizeof(obj) 

but variable names before each value can see variables need delete or split batches.

ideas?

you can iterate on both key , value of dictionary using .items()

for var, obj in locals().items():     print var, sys.getsizeof(obj) 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -