mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +03:00
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.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user