diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 8b01a7fad0..a13bf3510a 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -127,6 +127,11 @@ static PyTypeObject deque_type; static Py_ssize_t numfreeblocks = 0; static block *freeblocks[MAXFREEBLOCKS]; +static unsigned long long b_allocs = 0; +static unsigned long long b_frees = 0; + +#include + static block * newblock(void) { block *b; @@ -135,6 +140,7 @@ newblock(void) { return freeblocks[numfreeblocks]; } b = PyMem_Malloc(sizeof(block)); + b_allocs++; if (b != NULL) { return b; } @@ -150,6 +156,8 @@ freeblock(block *b) numfreeblocks++; } else { PyMem_Free(b); + b_frees++; + printf("%llu : %llu \n", b_allocs, b_frees); } }