Mailing List Archive

python/dist/src/Objects obmalloc.c,2.39,2.40
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv1392/python/Objects

Modified Files:
obmalloc.c
Log Message:
_PyObject_DebugDumpStats: renamed to _PyObject_DebugMallocStats.
Added code to call this when PYMALLOC_DEBUG is enabled, and envar
PYTHONMALLOCSTATS is set, whenever a new arena is obtained and once
late in the Python shutdown process.


Index: obmalloc.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v
retrieving revision 2.39
retrieving revision 2.40
diff -C2 -d -r2.39 -r2.40
*** obmalloc.c 12 Apr 2002 20:49:36 -0000 2.39
--- obmalloc.c 13 Apr 2002 08:29:14 -0000 2.40
***************
*** 449,452 ****
--- 449,457 ----
return NULL;

+ #ifdef PYMALLOC_DEBUG
+ if (Py_GETENV("PYTHONMALLOCSTATS"))
+ _PyObject_DebugMallocStats();
+ #endif
+
/* arenabase <- first pool-aligned address in the arena
nfreepools <- number of whole pools that fit after alignment */
***************
*** 1217,1221 ****
/* Print summary info to stderr about the state of pymalloc's structures. */
void
! _PyObject_DebugDumpStats(void)
{
uint i;
--- 1222,1226 ----
/* Print summary info to stderr about the state of pymalloc's structures. */
void
! _PyObject_DebugMallocStats(void)
{
uint i;
***************
*** 1246,1251 ****
fprintf(stderr, "Small block threshold = %d, in %u size classes.\n",
SMALL_REQUEST_THRESHOLD, numclasses);
- fprintf(stderr, "pymalloc malloc+realloc called %lu times.\n",
- serialno);

for (i = 0; i < numclasses; ++i)
--- 1251,1254 ----
***************
*** 1313,1316 ****
--- 1316,1320 ----
}
fputc('\n', stderr);
+ (void)printone("# times object malloc called", serialno);

PyOS_snprintf(buf, sizeof(buf),
***************
*** 1321,1324 ****
--- 1325,1329 ----

total = printone("# bytes in allocated blocks", allocated_bytes);
+ total += printone("# bytes in available blocks", available_bytes);

PyOS_snprintf(buf, sizeof(buf),
***************
*** 1326,1330 ****
total += printone(buf, (ulong)numfreepools * POOL_SIZE);

- total += printone("# bytes in available blocks", available_bytes);
total += printone("# bytes lost to pool headers", pool_header_bytes);
total += printone("# bytes lost to quantization", quantization);
--- 1331,1334 ----