Add more stats for freelist use and allocations. (GH-92211)

This commit is contained in:
Mark Shannon 2022-05-03 16:40:24 -06:00 committed by GitHub
parent e8d7661ff2
commit 836b17c9c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 0 deletions

View file

@ -158,6 +158,7 @@ PyList_New(Py_ssize_t size)
if (PyList_MAXFREELIST && state->numfree) {
state->numfree--;
op = state->free_list[state->numfree];
OBJECT_STAT_INC(from_freelist);
_Py_NewReference((PyObject *)op);
}
else
@ -353,6 +354,7 @@ list_dealloc(PyListObject *op)
#endif
if (state->numfree < PyList_MAXFREELIST && PyList_CheckExact(op)) {
state->free_list[state->numfree++] = op;
OBJECT_STAT_INC(to_freelist);
}
else
#endif