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:
Serhiy Storchaka 2016-07-03 21:03:53 +03:00
parent 6c94d10a19
commit 7e160ce356
7 changed files with 50 additions and 1 deletions

View file

@ -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