diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-15 21:01:34 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-15 21:01:34 +0000 |
commit | e64c7feb2fd80c89d2220cbe9e026a031f34509c (patch) | |
tree | b7842bbf8efc3b7849b29c8a1b67a4a196f9ee2e /src/backend/commands/trigger.c | |
parent | 5bab36e9f6c3f3a9e14a89e1124179a339d2c3a1 (diff) | |
download | postgresql-e64c7feb2fd80c89d2220cbe9e026a031f34509c.tar.gz postgresql-e64c7feb2fd80c89d2220cbe9e026a031f34509c.zip |
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.
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r-- | src/backend/commands/trigger.c | 13 |
1 files changed, 4 insertions, 9 deletions
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); |