GH-148189: Fix miscalculation of type-specific free list memory use#148190
GH-148189: Fix miscalculation of type-specific free list memory use#148190MazinSharaf wants to merge 5 commits intopython:mainfrom
Conversation
Adjusted memory calculation for PyTupleObject freelist entries.
|
As mentioned in the issue report, don't add the size of the GC header yourself. The layout of objects is subject to change over the time. Use This also needs a brief NEWS entry. |
|
On third thought 😉, I'm not actually sure exactly how to spell this. Bottom line is that the output should match the results given by |
|
OK, I was wrong! tp_basicsize does not include GC overhead, sys.getsizef() adds that itself if the type participates in gc. So your original approach appears to be the best approach after all! My apologies |
|
OK, I think your new approach is good! Except, perhaps, for tuples. I believe I was wrong that |
|
Well, I tried to add a NEWS entry, but blurb-it gave me an error:
No idea why 😦 |
|
Nobody seems to know why I can't add a NEWS entry on your behalf. You'll have to try it. Look for
Click on "..." to its right. then "View details" in the pop-up menu. That will take you to the web version of Blurb-it. Fill in the issue and PR numbers (148189 and 148190). select "Core" from the dropdown list, and add text, like
Then submit it. If all goes well, Blurb-it will magically add another file to this PR. |
|
Ok just to clarify I'll revert the tuple change and add a NEWS entry for it? Sorry for taking time to respond as well. |
Removed unnecessary comment regarding memory calculation and the memory calculation itself.
|
@tim-one https://github.com/python/blurb_it?tab=readme-ov-file#about seems to imply that the GH App is expected to be installed in the contributor account, giving access to the fork repo. // looks like @MazinSharaf figured it out already You can probably go to the branch in the fork on GH UI and create the file manually, w/o blurb-it, FYI. |
|
Yay! The NEWS entry looks good! Although they probably want some reST markup around Please check to see that all free-list types in the output deliver the same story as A difference is that lists and dicts in free lists are empty, but tuples are in multiple free lists, one for each number of contained elements. The VAR size stuff you did before was fine so far as it went, but needs to add in the "preheader" size too. |
Fixing calculation of bytes in type-specific free lists
GH-148189: Fix miscalculation of type-specific free list memory use