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

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/

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).
You're going to have to think. There's no magic answer. Hire someone who knows Python's implementation well, and they'll be able to tell your the answer as fast as they can read your Python source code. Unless it's a memory leak in C code (yours, not Python's).
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.
Too AI-like. --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (2)
-
Guido van Rossum
-
Zooko