Start of change_C_Quickpool_Report() — Generate Quick Pool Memory Manager ReportEnd of change

Format

#include <stdlib.h>
void _C_Quickpool_Report(void);

Language Level: Extended

Threadsafe: Yes.

Description

Start of changeThe _C_Quickpool_Report() function generates a spooled file that contains a snapshot of the memory used by the Quick Pool memory manager in the current activation group. If the Quick Pool memory manager has not been enabled for the current activation group or if statistics collection has not been enabled, the report will be a message that indicates no data is collected.End of change

Start of changeIf the Quick Pool memory manager has been enabled and statistics collection has been enabled, the report that is generated indicates the number of allocation attempts for each 16 bytes of memory during the time that statistics collection was enabled. In addition, the report indicates the maximum number of outstanding allocations (peak allocations) that is reached for each pool. If no storage requests are made for a given range of memory, that range of memory will not be included in the report. No output is generated for allocations larger than the maximum cell size (4096 bytes).End of change

Return Value

There is no return value for the function.

Example that uses _C_Quickpool_Report()

Start of changeThe following example uses _C_Quickpool_Init() to enable Quick Pool memory manager. It uses the _C_COLLECT_STATS flag to collect information. The collected information is printed using _C_Quickpool_Report().

Start of change#include <stdlib.h>
#include <stdio.h>
int main(void) {
  char *p;
  int   i;
  unsigned int cell_sizes[2]       = { 16, 64 };
  unsigned int cells_per_extent[2] = { 16, 16 };
  _C_Quickpool_Debug_T  dbgVals = { _C_COLLECT_STATS, 'A', 'B' };

  if (_C_Quickpool_Init(2, cell_sizes, cells_per_extent) {
    printf("Error initializing Quick Pool memory manager.\n");
    return -1;
  }

  _C_Quickpool_Debug(&dbgVals);

  for (i = 1; i <= 64; i++) {
    p = malloc(i);
    free(p);
  }
  p = malloc(128);
  free(p);
  _C_Quickpool_Report();
  return 0;
}
/*****************Spooled File Output should be similar to:**********
Pool 1 (16 bytes, 1 peak allocations):
1-16 bytes: 16 allocations
Pool 2 (64 bytes, 1 peak allocations):
17-32 bytes: 16 allocations
33-48 bytes: 16 allocations
49-64 bytes: 16 allocations
Remaining allocations smaller than the largest cell size (4096 bytes):
113-128 bytes: 1 allocations
*******************************************************************/End of change
End of change

Related Information



[ Top of Page | Previous Page | Next Page | Contents | Index ]