This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients Alexander.Belopolsky, loewis, mark.dickinson, schuppenies
Date 2010-03-19.08:36:27
SpamBayes Score 7.4151796e-13
Marked as misclassified No
Message-id <1268987791.62.0.119724670422.issue3690@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-03-19 08:36:31mark.dickinsonsetrecipients: + mark.dickinson, loewis, schuppenies, Alexander.Belopolsky
2010-03-19 08:36:31mark.dickinsonsetmessageid: <1268987791.62.0.119724670422.issue3690@psf.upfronthosting.co.za>
2010-03-19 08:36:28mark.dickinsonlinkissue3690 messages
2010-03-19 08:36:27mark.dickinsoncreate