Can I get the total memory usage of Python?

Tim Peters tim.one at comcast.net
Fri May 23 10:47:42 EDT 2003


[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).






More information about the Python-list mailing list