mirror of
https://github.com/python/cpython.git
synced 2026-05-04 09:31:02 +00:00
GH-148189: Fix miscalculation of type-specific free list memory use (#148190)
* Fix calculation of PyListObject size in allocator * Fix size calculation in _PyDict_DebugMallocStats * Fix memory size calculation in tupleobject.c Adjusted memory calculation for PyTupleObject freelist entries. * Revert in tupleobject.c Removed unnecessary comment regarding memory calculation and the memory calculation itself. * 📜🤖 Added by blurb_it. * Update tupleobject.c --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
This commit is contained in:
parent
c1940bcfc8
commit
1fc2b38d63
4 changed files with 4 additions and 3 deletions
|
|
@ -0,0 +1 @@
|
|||
Repaired undercount of bytes in type-specific free lists reported by sys._debugmallocstats(). For types that participate in cyclic garbage collection, it was missing two pointers used by GC.
|
||||
|
|
@ -443,7 +443,7 @@ _PyDict_DebugMallocStats(FILE *out)
|
|||
{
|
||||
_PyDebugAllocatorStats(out, "free PyDictObject",
|
||||
_Py_FREELIST_SIZE(dicts),
|
||||
sizeof(PyDictObject));
|
||||
_PyType_PreHeaderSize(&PyDict_Type) + sizeof(PyDictObject));
|
||||
_PyDebugAllocatorStats(out, "free PyDictKeysObject",
|
||||
_Py_FREELIST_SIZE(dictkeys),
|
||||
sizeof(PyDictKeysObject));
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ _PyList_DebugMallocStats(FILE *out)
|
|||
_PyDebugAllocatorStats(out,
|
||||
"free PyListObject",
|
||||
_Py_FREELIST_SIZE(lists),
|
||||
sizeof(PyListObject));
|
||||
_PyType_PreHeaderSize(&PyList_Type) + sizeof(PyListObject));
|
||||
}
|
||||
|
||||
PyObject *
|
||||
|
|
|
|||
|
|
@ -1286,6 +1286,6 @@ _PyTuple_DebugMallocStats(FILE *out)
|
|||
PyOS_snprintf(buf, sizeof(buf),
|
||||
"free %d-sized PyTupleObject", len);
|
||||
_PyDebugAllocatorStats(out, buf, _Py_FREELIST_SIZE(tuples[i]),
|
||||
_PyObject_VAR_SIZE(&PyTuple_Type, len));
|
||||
_PyType_PreHeaderSize(&PyTuple_Type) + _PyObject_VAR_SIZE(&PyTuple_Type, len));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue