mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #23034: The output of a special Python build with defined COUNT_ALLOCS,
SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can be re-enabled using the "-X showalloccount" option. It now outputs to stderr instead of stdout.
This commit is contained in:
parent
6c94d10a19
commit
7e160ce356
7 changed files with 50 additions and 1 deletions
|
@ -82,6 +82,16 @@ static size_t count_reuse = 0;
|
|||
static void
|
||||
show_alloc(void)
|
||||
{
|
||||
PyObject *xoptions, *value;
|
||||
_Py_IDENTIFIER(showalloccount);
|
||||
|
||||
xoptions = PySys_GetXOptions();
|
||||
if (xoptions == NULL)
|
||||
return;
|
||||
value = _PyDict_GetItemId(xoptions, &PyId_showalloccount);
|
||||
if (value != Py_True)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "List allocations: %" PY_FORMAT_SIZE_T "d\n",
|
||||
count_alloc);
|
||||
fprintf(stderr, "List reuse through freelist: %" PY_FORMAT_SIZE_T
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue