diff Python/pythonrun.c @ 80777:c40f4c19d20b

Issue #13390: New function :func:`sys.getallocatedblocks()` returns the number of memory blocks currently allocated. Also, the ``-R`` option to regrtest uses this function to guard against memory allocation leaks.
author Antoine Pitrou <solipsis@pitrou.net>
date Sun, 09 Dec 2012 14:28:26 +0100
parents 215297665098
children 367167f93c30
line wrap: on
line diff
--- a/Python/pythonrun.c	Sun Dec 09 16:22:17 2012 +1000
+++ b/Python/pythonrun.c	Sun Dec 09 14:28:26 2012 +0100
@@ -38,9 +38,10 @@
 #ifndef Py_REF_DEBUG
 #define PRINT_TOTAL_REFS()
 #else /* Py_REF_DEBUG */
-#define PRINT_TOTAL_REFS() fprintf(stderr,                              \
-                   "[%" PY_FORMAT_SIZE_T "d refs]\n",                   \
-                   _Py_GetRefTotal())
+#define PRINT_TOTAL_REFS() fprintf(stderr,                   \
+                   "[%" PY_FORMAT_SIZE_T "d refs, "          \
+                   "%" PY_FORMAT_SIZE_T "d blocks]\n",       \
+                   _Py_GetRefTotal(), _Py_GetAllocatedBlocks())
 #endif
 
 #ifdef __cplusplus