Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: > Caching itself is no criteria, but allocating memory without giving > the user a chance to find out should be (in this context). > ... calling match.regs creates a > tuple which is not there before, but cannot be removed > afterwards. This is why I handled it separately.
Well, so why only include the tuple, and not objects inside the tuple? They may also count in allocated memory (not often: small numbers are shared) Does the same criteria apply to function.func_defaults and function.doc members? Both can be None, sizeof(None) would be added twice. Would you say the same for property members? class C(object): def setx(self): self.__x = 42 x = property(lambda self: self.__x) the value is not there before you call o.setx(), and cannot be removed afterwards. IMO, the criteria (to decide whether a container should include a particular PyObject member in its sizeof) should not include the way the member is created, or who created it, but only the current layout in memory. For example: can other objects hold references to this member, does it appear in gc.objects... And I propose this simple algorithm: do not include any referenced PyObject :-) _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3122> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com