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

@ -1942,6 +1942,7 @@ async_gen_wrapped_val_dealloc(_PyAsyncGenWrappedValue *o)
if (state->value_numfree < _PyAsyncGen_MAXFREELIST) {
assert(_PyAsyncGenWrappedValue_CheckExact(o));
state->value_freelist[state->value_numfree++] = o;
OBJECT_STAT_INC(to_freelist);
}
else
#endif
@ -2018,6 +2019,7 @@ _PyAsyncGenValueWrapperNew(PyObject *val)
if (state->value_numfree) {
state->value_numfree--;
o = state->value_freelist[state->value_numfree];
OBJECT_STAT_INC(from_freelist);
assert(_PyAsyncGenWrappedValue_CheckExact(o));
_Py_NewReference((PyObject*)o);
}