From e64c7feb2fd80c89d2220cbe9e026a031f34509c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 15 Dec 2002 21:01:34 +0000 Subject: Tweak default memory context allocation policy so that a context is not given any malloc block until something is first allocated in it; but thereafter, MemoryContextReset won't release that first malloc block. This preserves the quick-reset property of the original policy, without forcing 8K to be allocated to every context whether any of it is ever used or not. Also, remove some more no-longer-needed explicit freeing during ExecEndPlan. --- src/backend/commands/trigger.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/backend/commands/trigger.c') diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 921a11f84c6..3dceb548e21 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.141 2002/11/25 03:36:50 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.142 2002/12/15 21:01:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2008,13 +2008,9 @@ deferredTriggerInvokeEvents(bool immediate_only) void DeferredTriggerInit(void) { - /* - * Since this context will never be reset, give it a minsize of 0. - * This avoids using any memory if the session never stores anything. - */ deftrig_gcxt = AllocSetContextCreate(TopMemoryContext, "DeferredTriggerSession", - 0, + ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); } @@ -2041,12 +2037,11 @@ DeferredTriggerBeginXact(void) /* * Create the per transaction memory context and copy all states from - * the per session context to here. Set the minsize to 0 to avoid - * wasting memory if there is no deferred trigger data. + * the per session context to here. */ deftrig_cxt = AllocSetContextCreate(TopTransactionContext, "DeferredTriggerXact", - 0, + ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); oldcxt = MemoryContextSwitchTo(deftrig_cxt); -- cgit v1.2.3