Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5be44fa

Browse files
committed
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.
1 parent 364ef51 commit 5be44fa

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/backend/tcop/postgres.c

+8-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.359 2003/08/12 18:52:38 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.360 2003/08/13 16:16:23 tgl Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1753,14 +1753,19 @@ finish_xact_command(void)
17531753
/* Cancel any active statement timeout before committing */
17541754
disable_sig_alarm(true);
17551755

1756+
#ifdef MEMORY_CONTEXT_CHECKING
1757+
/* Check memory before committing (since commit discards much) */
1758+
MemoryContextCheck(TopMemoryContext);
1759+
#endif
1760+
17561761
/* Now commit the command */
17571762
ereport(DEBUG3,
17581763
(errmsg_internal("CommitTransactionCommand")));
17591764

17601765
CommitTransactionCommand();
17611766

17621767
#ifdef SHOW_MEMORY_STATS
1763-
/* Print mem stats at each commit for leak tracking */
1768+
/* Print mem stats after each commit for leak tracking */
17641769
if (ShowStats)
17651770
MemoryContextStats(TopMemoryContext);
17661771
#endif
@@ -2646,7 +2651,7 @@ PostgresMain(int argc, char *argv[], const char *username)
26462651
if (!IsUnderPostmaster)
26472652
{
26482653
puts("\nPOSTGRES backend interactive interface ");
2649-
puts("$Revision: 1.359 $ $Date: 2003/08/12 18:52:38 $\n");
2654+
puts("$Revision: 1.360 $ $Date: 2003/08/13 16:16:23 $\n");
26502655
}
26512656

26522657
/*
@@ -3063,15 +3068,6 @@ PostgresMain(int argc, char *argv[], const char *username)
30633068
errmsg("invalid frontend message type %d",
30643069
firstchar)));
30653070
}
3066-
3067-
#ifdef MEMORY_CONTEXT_CHECKING
3068-
3069-
/*
3070-
* Check all memory after each backend loop. This is a rather
3071-
* weird place to do it, perhaps.
3072-
*/
3073-
MemoryContextCheck(TopMemoryContext);
3074-
#endif
30753071
} /* end of input-reading loop */
30763072

30773073
/* can't get here because the above loop never exits */

0 commit comments

Comments
 (0)