Measure the memory cost in Python
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Apr 30 13:57:09 EDT 2009
En Thu, 30 Apr 2009 08:00:07 -0300, Li Wang <li.wang.d at gmail.com> escribió:
> I want to measure the actual memory cost of a particular step in my
> program
> (Python program), does anyone know if there is some function in Python
> could
> help me to do this job? Or should I seek other tools to help me?
It's hard to compute from inside the program; I'd use OS tools to monitor
memory usage.
Python 2.6 has sys.getsizeof() -- you have to apply it recursively, but
not count objects more than once.
--
Gabriel Genellina
More information about the Python-list
mailing list