1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Move MemoryContextCheck() call from bottom of PostgresMain loop to

just before CommitTransactionCommand().  This is a more sensible place
to put it since commit discards a lot of contexts, and we'd not find
out about stomps affecting only transaction-local contexts.
This commit is contained in:
Tom Lane
2003-08-13 16:16:23 +00:00
parent 364ef51484
commit 5be44fa453

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.359 2003/08/12 18:52:38 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.360 2003/08/13 16:16:23 tgl Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
@ -1753,6 +1753,11 @@ finish_xact_command(void)
/* Cancel any active statement timeout before committing */ /* Cancel any active statement timeout before committing */
disable_sig_alarm(true); disable_sig_alarm(true);
#ifdef MEMORY_CONTEXT_CHECKING
/* Check memory before committing (since commit discards much) */
MemoryContextCheck(TopMemoryContext);
#endif
/* Now commit the command */ /* Now commit the command */
ereport(DEBUG3, ereport(DEBUG3,
(errmsg_internal("CommitTransactionCommand"))); (errmsg_internal("CommitTransactionCommand")));
@ -1760,7 +1765,7 @@ finish_xact_command(void)
CommitTransactionCommand(); CommitTransactionCommand();
#ifdef SHOW_MEMORY_STATS #ifdef SHOW_MEMORY_STATS
/* Print mem stats at each commit for leak tracking */ /* Print mem stats after each commit for leak tracking */
if (ShowStats) if (ShowStats)
MemoryContextStats(TopMemoryContext); MemoryContextStats(TopMemoryContext);
#endif #endif
@ -2646,7 +2651,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface "); puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.359 $ $Date: 2003/08/12 18:52:38 $\n"); puts("$Revision: 1.360 $ $Date: 2003/08/13 16:16:23 $\n");
} }
/* /*
@ -3063,15 +3068,6 @@ PostgresMain(int argc, char *argv[], const char *username)
errmsg("invalid frontend message type %d", errmsg("invalid frontend message type %d",
firstchar))); firstchar)));
} }
#ifdef MEMORY_CONTEXT_CHECKING
/*
* Check all memory after each backend loop. This is a rather
* weird place to do it, perhaps.
*/
MemoryContextCheck(TopMemoryContext);
#endif
} /* end of input-reading loop */ } /* end of input-reading loop */
/* can't get here because the above loop never exits */ /* can't get here because the above loop never exits */