[issue3690] sys.getsizeof wrong for Py3k bool objects

Martin v. Löwis report at bugs.python.org
Sun Sep 14 18:23:02 CEST 2008


Martin v. Löwis <martin at v.loewis.de> added the comment:

>> In any case, I also think this doesn't matter much either way. 
> Why do you think so?

What's the actual difference that this change makes? At most 8
bytes per object, right? And for two objects in total. So if somebody
would compute memory consumption, they might be off by not more
than 14 bytes, in total. Compared to all the other errors that memory
computation makes (e.g. malloc headers, rounding-up to multiples of
8 in obmalloc) which aren't accounted-for in sys.getsizeof, this
difference is negligible.

What's more, the small_ints aren't dynamically allocated, either,
but instead, each small_int takes a complete PyLongObject. If
that was also considered in long_sizeof, the computation would happen
to be completely correct for bool also.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3690>
_______________________________________


More information about the Python-bugs-list mailing list