How to measure the memory cost in Python?

Aahz aahz at pythoncraft.com
Sun May 3 12:51:13 EDT 2009


In article <7744f434-dd43-4010-ba25-90096f59d1d9 at n7g2000prc.googlegroups.com>,
CTO  <debatem1 at gmail.com> wrote:
>
>I will admit, I have *no idea* what that code is doing, but in looking
>through the gc module documentation, I'm seeing the gc.get_objects
>function. Would it be equivalent to what the OP is asking to track the
>size of every element returned by that?

Perhaps.  gc.get_objects() only returns objects tracked by GC (i.e.
containers).  You would need to also check all the object references
held by the containers.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Typing is cheap.  Thinking is expensive."  --Roy Smith



More information about the Python-list mailing list