Message101310
I don't think there's anything worth fixing here. It's true that getsizeof is sometimes going to return results that are too small, because there are a good few places in the longobject internals where it's not predictable in advance exactly how much space is needed, so memory is overallocated.
The case of the small int 0 is one example of this, but it's far from the only one. For example, if you multiply a 2-limb long by another 2-limb long the code will always allocate 4 limbs for the result, even though it'll often turn out that the result fits in 3 limbs. Should sys.getsizeof return base_size + 4 * sizeof_limb in that case, instead of base_size + 3 * sizeof_limb? That would be difficult to achieve, since long objects don't currently know how much space was actually allocated to hold them. |
|
Date |
User |
Action |
Args |
2010-03-19 08:36:31 | mark.dickinson | set | recipients:
+ mark.dickinson, loewis, schuppenies, Alexander.Belopolsky |
2010-03-19 08:36:31 | mark.dickinson | set | messageid: <1268987791.62.0.119724670422.issue3690@psf.upfronthosting.co.za> |
2010-03-19 08:36:28 | mark.dickinson | link | issue3690 messages |
2010-03-19 08:36:27 | mark.dickinson | create | |
|