Can I get the total memory usage of Python?

Cameron Laird claird at lairds.com
Fri May 23 11:50:54 EDT 2003


In article <mailman.1053701439.24056.python-list at python.org>,
Tim Peters  <tim.one at comcast.net> wrote:
>[Cameron Laird]
>> What's the feasibility of an enhancement in a future
>> version of Python to provide greater introspective
>> power in regard to memory allocation?  I'll naively
>> speculate that, if we can just agree on an interface,
>> it should impose no particular runtime costs; every-
>> thing necessary is already available on the C side, and needs only to
>> be exposed. --
>
>Except that there's no standard way in C to query the platform malloc about
>how much memory it's actually using, and all mallocs have hidden overheads.
>When allocating a large number of small objects, malloc overhead can be more
>than half the story.  In 2.3 pymalloc takes most of that out of the platform
>malloc's hands (although it still grabs *large* chunks from the platfrom
>malloc, and pymalloc still can't know how much overhead the platform malloc
>chews up for those).
>
>

Right; it's a general principle of common OSs that 
t's shockingly hairy to find out what is *really*
going on in memory.

What I meant, although far too elliptically, was just
at the pymalloc level.  No, that doesn't correspond
to real memory use, as seen "from the outside"; my own
intentions for memory introspection are satisfied by
anything which reliably enumerates my use of memory,
even if it's inaccurately quantified.  It's enough
for me to have a handle on how many and which objects
I'm asking the system to juggle.
-- 

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