Martin v. Löwis <mar...@v.loewis.de> added the comment:

I can propose a specification of getsizeof: if you somehow manage to traverse 
all objects (without considering an object twice), and sum up the getsizeof 
results, you should end up with something close to, but smaller than the actual 
memory consumption. How close is a quality-of-implementation issue (so always 
returning 0 would be correct-but-useless).

It may be that implementations can also support counting certain hidden memory 
usage (headers, blocks shared across instances that are not objects 
themselves). Such functions would should have different names and interfaces 
(e.g. sys.gethiddenblocks(o) may return a list of (address, size) pairs); 
CPython doesn't provide any such function (although sys.mallocoverhead might be 
useful).

In any case: I'm not convinced that it is useful to mark functions as 
CPython-specific in the documentation. This clutters the documentation, and is 
of interest only for language lawyers. So if implementation details are to be 
documented, I'd prefer this to happen in a separate document.

----------
nosy: +loewis

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10994>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to