Can I get the total memory usage of Python?

Cameron Laird claird at lairds.com
Fri May 23 16:35:51 EDT 2003


In article <mailman.1053710377.2440.python-list at python.org>,
Tim Peters  <tim.one at comcast.net> wrote:
		.
		.
		.
>You may have meant that <wink>, but note that pymalloc only intercepts
>requests for "small" objects, and only for those small-object subsystems
>that explicitly choose to use pymalloc.  For example, memory for a large
>list comes straight from the platform malloc, and even though ints are small
>objects they use their own layer of cruft around the platform malloc.  IOW,
>there is no choke point for memory allocation in Python above the platform
>malloc.
Whoops.  My, have I learned a lot this week.
Good summary; thanks.
		.
		.
		.
>That's a different question:  malloc and pymalloc requests are untyped --
>they have no idea what the memory is used for.  You may like the stats you
>can get in a Python COUNT_ALLOCS build instead:  that keeps track of the
>current total number of allocations, frees, and highwater mark (max value of
>#allocations - #frees over time) on a per-type basis (so, e.g., the stats
>for ints are distinct from the stats for floats).  That's been available
>"forever", but it's a special build because it's not particularly cheap to
>keep track of this stuff.
>
>

No, indeed.  I understand that expense.  Hmmmmmm;
I suspect the usual result--the hardest part about
this idea will be to decide what I (we) want.  All
the possibilities have unsavory aspects.
-- 

Cameron Laird <Cameron at Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://phaseit.net/claird/home.html




More information about the Python-list mailing list