summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-02-03 14:17:15 (GMT)
committerGitHub <noreply@github.com>2020-02-03 14:17:15 (GMT)
commitc6e5c1123bac6cbb4c85265155af5349dcea522e (patch)
treec9bc04bdd74fbf9d8f86dd1999d8acc0f4655fc3 /Objects/listobject.c
parent869c0c99b94ff9527acc1ca060164ab3d1bdcc53 (diff)
downloadcpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.zip
cpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.tar.gz
cpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.tar.bz2
bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)
Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 2c07ceb..c93a0fe 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -94,29 +94,6 @@ list_preallocate_exact(PyListObject *self, Py_ssize_t size)
return 0;
}
-/* Debug statistic to compare allocations with reuse through the free list */
-#undef SHOW_ALLOC_COUNT
-#ifdef SHOW_ALLOC_COUNT
-static size_t count_alloc = 0;
-static size_t count_reuse = 0;
-
-static void
-show_alloc(void)
-{
- PyInterpreterState *interp = _PyInterpreterState_Get();
- if (!interp->config.show_alloc_count) {
- return;
- }
-
- fprintf(stderr, "List allocations: %" PY_FORMAT_SIZE_T "d\n",
- count_alloc);
- fprintf(stderr, "List reuse through freelist: %" PY_FORMAT_SIZE_T
- "d\n", count_reuse);
- fprintf(stderr, "%.2f%% reuse rate\n\n",
- (100.0*count_reuse/(count_alloc+count_reuse)));
-}
-#endif
-
/* Empty list reuse scheme to save calls to malloc and free */
#ifndef PyList_MAXFREELIST
#define PyList_MAXFREELIST 80
@@ -156,13 +133,6 @@ PyObject *
PyList_New(Py_ssize_t size)
{
PyListObject *op;
-#ifdef SHOW_ALLOC_COUNT
- static int initialized = 0;
- if (!initialized) {
- Py_AtExit(show_alloc);
- initialized = 1;
- }
-#endif
if (size < 0) {
PyErr_BadInternalCall();
@@ -172,16 +142,10 @@ PyList_New(Py_ssize_t size)
numfree--;
op = free_list[numfree];
_Py_NewReference((PyObject *)op);
-#ifdef SHOW_ALLOC_COUNT
- count_reuse++;
-#endif
} else {
op = PyObject_GC_New(PyListObject, &PyList_Type);
if (op == NULL)
return NULL;
-#ifdef SHOW_ALLOC_COUNT
- count_alloc++;
-#endif
}
if (size <= 0)
op->ob_item = NULL;