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/executor/execMain.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/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index a25f2f2e296..f17fbcbb466 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -26,7 +26,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.193 2002/12/15 16:17:45 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.194 2002/12/15 21:01:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -775,6 +775,12 @@ initResultRelInfo(ResultRelInfo *resultRelInfo, * ExecEndPlan * * Cleans up the query plan -- closes files and frees up storage + * + * NOTE: we are no longer very worried about freeing storage per se + * in this code; FreeExecutorState should be guaranteed to release all + * memory that needs to be released. What we are worried about doing + * is closing relations and dropping buffer pins. Thus, for example, + * tuple tables must be cleared or dropped to ensure pins are released. * ---------------------------------------------------------------- */ void @@ -803,7 +809,7 @@ ExecEndPlan(PlanState *planstate, EState *estate) /* * close the result relation(s) if any, but hold locks until xact - * commit. Also clean up junkfilters if present. + * commit. */ resultRelInfo = estate->es_result_relations; for (i = estate->es_num_result_relations; i > 0; i--) @@ -811,9 +817,6 @@ ExecEndPlan(PlanState *planstate, EState *estate) /* Close indices and then the relation itself */ ExecCloseIndices(resultRelInfo); heap_close(resultRelInfo->ri_RelationDesc, NoLock); - /* Delete the junkfilter if any */ - if (resultRelInfo->ri_junkFilter != NULL) - ExecFreeJunkFilter(resultRelInfo->ri_junkFilter); resultRelInfo++; } @@ -824,16 +827,6 @@ ExecEndPlan(PlanState *planstate, EState *estate) heap_close(estate->es_into_relation_descriptor, NoLock); /* - * There might be a junkfilter without a result relation. - */ - if (estate->es_num_result_relations == 0 && - estate->es_junkFilter != NULL) - { - ExecFreeJunkFilter(estate->es_junkFilter); - estate->es_junkFilter = NULL; - } - - /* * close any relations selected FOR UPDATE, again keeping locks */ foreach(l, estate->es_rowMark) |