It seems that ExecInit/EndIndexScan is leaking some memory...
authorBruce Momjian
Sun, 23 Jun 2002 21:29:32 +0000 (21:29 +0000)
committerBruce Momjian
Sun, 23 Jun 2002 21:29:32 +0000 (21:29 +0000)
For example, if I run a query, that uses an index scan, and call
MemoryContextSt ats (CurrentMemoryContext) before ExecutorStart() and
after ExecutorEnd() in ProcessQuery(), I am consistently see ing that
the 'after' call shows 256 bytes more used, then 'before'...

The problem seems to be in ExecEndIndexScan - it does not release
scanstate, ind exstate, indexstate->iss_RelationDescs and indexstate ->
iss_ScanDescs...

Dmitry Tkach

src/backend/executor/nodeIndexscan.c

index d33147793f8e5fca7494ba470ec4c1be03a8557f..5eb15f7f5cf2148a35ce8842bb1e14651a35480e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.69 2002/06/20 20:29:28 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.70 2002/06/23 21:29:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -516,6 +516,10 @@ ExecEndIndexScan(IndexScan *node)
     */
    ExecClearTuple(scanstate->cstate.cs_ResultTupleSlot);
    ExecClearTuple(scanstate->css_ScanTupleSlot);
+   pfree(scanstate);
+   pfree(indexstate->iss_RelationDescs);
+   pfree(indexstate->iss_ScanDescs);
+   pfree(indexstate);
 }
 
 /* ----------------------------------------------------------------