src/backend/utils/mmgr/mcxt.c
void
MemoryContextStatsDetail(MemoryContext context, int max_children,
						 bool print_to_stderr)
{
	MemoryContextCounters grand_totals;

	memset(&grand_totals, 0, sizeof(grand_totals));

	MemoryContextStatsInternal(context, 0, true, max_children, &grand_totals, print_to_stderr);

	if (print_to_stderr)
		fprintf(stderr,
				"Grand total: %zu bytes in %zu blocks; %zu free (%zu chunks); %zu used\n",
				grand_totals.totalspace, grand_totals.nblocks,
				grand_totals.freespace, grand_totals.freechunks,
				grand_totals.totalspace - grand_totals.freespace);
	else

		/*
		 * Use LOG_SERVER_ONLY to prevent the memory contexts from being sent
		 * to the connected client.
		 *
		 * We don't buffer the information about all memory contexts in a
		 * backend into StringInfo and log it as one message. Otherwise which
		 * may require the buffer to be enlarged very much and lead to OOM
		 * error since there can be a large number of memory contexts in a
		 * backend. Instead, we log one message per memory context.
		 */
		ereport(LOG_SERVER_ONLY,
				(errhidestmt(true),
				 errhidecontext(true),
				 errmsg_internal("Grand total: %zu bytes in %zu blocks; %zu free (%zu chunks); %zu used",
								 grand_totals.totalspace, grand_totals.nblocks,
								 grand_totals.freespace, grand_totals.freechunks,
								 grand_totals.totalspace - grand_totals.freespace)));
}
/*
 * MemoryContextStatsDetail
 *
 * Entry point for use if you want to vary the number of child contexts shown.
 *
 * If print_to_stderr is true, print statistics about the memory contexts
 * with fprintf(stderr), otherwise use ereport().
 */
MemoryContextStatsDetail
Entry point for use if you want to vary the number of child contexts shown.

If print_to_stderr is true, print statistics about the memory contexts
with fprintf(stderr), otherwise use ereport().
MemoryContextStatsDetail Entry point for use if you want to vary the number of child contexts shown . If print_to_stderr is true print statistics about the memory contexts with fprintf ( stderr ) otherwise use ereport () .
void
MemoryContextStatsDetail(MemoryContext context, int max_children,
						 bool print_to_stderr)
{
	MemoryContextCounters grand_totals;
	memset(&grand_totals, 0, sizeof(grand_totals));
	MemoryContextStatsInternal(context, 0, true, max_children, &grand_totals, print_to_stderr);
	if (print_to_stderr)
		fprintf(stderr,
				"Grand total: %zu bytes in %zu blocks; %zu free (%zu chunks); %zu used\n",
				grand_totals.totalspace, grand_totals.nblocks,
				grand_totals.freespace, grand_totals.freechunks,
				grand_totals.totalspace - grand_totals.freespace);
	else
		ereport(LOG_SERVER_ONLY,
				(errhidestmt(true),
				 errhidecontext(true),
				 errmsg_internal("Grand total: %zu bytes in %zu blocks; %zu free (%zu chunks); %zu used",
								 grand_totals.totalspace, grand_totals.nblocks,
								 grand_totals.freespace, grand_totals.freechunks,
								 grand_totals.totalspace - grand_totals.freespace)));
}
void MemoryContextStatsDetail ( MemoryContext context , int max_children , bool print_to_stderr ) { MemoryContextCounters grand_totals ; memset ( & grand_totals , 0 , sizeof ( grand_totals ) ) ; MemoryContextStatsInternal ( context , 0 , true , max_children , & grand_totals , print_to_stderr ) ; if ( print_to_stderr ) fprintf ( stderr , " \n " , grand_totals . totalspace , grand_totals . nblocks , grand_totals . freespace , grand_totals . freechunks , grand_totals . totalspace - grand_totals . freespace ) ; else ereport ( LOG_SERVER_ONLY , ( errhidestmt ( true ) , errhidecontext ( true ) , errmsg_internal ( " " , grand_totals . totalspace , grand_totals . nblocks , grand_totals . freespace , grand_totals . freechunks , grand_totals . totalspace - grand_totals . freespace ) ) ) ; }
MemoryContextStatsDetail
 Entry point for use if you want to vary the number of child contexts shown.
MemoryContextStatsDetail Entry point for use if you want to vary the number of child contexts shown .
/*
		 * Use LOG_SERVER_ONLY to prevent the memory contexts from being sent
		 * to the connected client.
		 *
		 * We don't buffer the information about all memory contexts in a
		 * backend into StringInfo and log it as one message. Otherwise which
		 * may require the buffer to be enlarged very much and lead to OOM
		 * error since there can be a large number of memory contexts in a
		 * backend. Instead, we log one message per memory context.
		 */