print_location = PRINT_STATS_TO_LOGS;
/* num_contexts report number of contexts aggregated in the output */
- MemoryContextStatsInternal(context, 0, max_level, max_children,
+ MemoryContextStatsInternal(context, 1, max_level, max_children,
&grand_totals, print_location, &num_contexts);
if (print_to_stderr)
*/
child = context->firstchild;
ichild = 0;
- if (level < max_level && !stack_is_too_deep())
+ if (level <= max_level && !stack_is_too_deep())
{
for (; child != NULL && ichild < max_children;
child = child->nextchild, ichild++)
if (print_location == PRINT_STATS_TO_STDERR)
{
- for (int i = 0; i <= level; i++)
+ for (int i = 0; i < level; i++)
fprintf(stderr, " ");
fprintf(stderr,
"%d more child contexts containing %zu total in %zu blocks; %zu free (%zu chunks); %zu used\n",
if (print_to_stderr)
{
- for (i = 0; i < level; i++)
+ for (i = 1; i < level; i++)
fprintf(stderr, " ");
fprintf(stderr, "%s: %s%s\n", name, stats_string, truncated_ident);
}
{
MemoryContextCounters grand_totals;
int num_contexts = 0;
- int level = 0;
path = NIL;
memset(&grand_totals, 0, sizeof(grand_totals));
- MemoryContextStatsInternal(c, level, 100, 100, &grand_totals,
+ MemoryContextStatsInternal(c, 1, 100, 100, &grand_totals,
PRINT_STATS_NONE, &num_contexts);
path = compute_context_path(c, context_id_lookup);