[Python-Dev] PEP 42: sizeof(obj) builtin

Zooko zooko@zooko.com
Fri, 31 Jan 2003 11:20:51 -0500


 GvR wrote:
>
> But the question is incredibly ill-defined, so it's not clear that
> Raymond will be able to calculate a useful answer.  (See Tim's post.)

Even a simple measure which double-counted everything might be useful to me.  
Or perhaps a simple measure which counted only memory that would be freed by 
destroying this object.

I am after all looking for a needle (excessive memory usage) which is two orders 
of magnitude bigger than the hay (memory usage that I am sure I want).

I don't know what the very *best* kind of answer would be.  Perhaps a 
recursively defined "weight", where an object which holds the *only* reference 
to another object carries the weight of that other object, and an object which 
holds one of K references to another object carries 1/Kth of its weight.  I'm 
not sure that would be useful, but it might be.

Regards,

Zooko

http://zooko.com/
http://mnet.sf.net/