diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-15 16:17:59 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-15 16:17:59 +0000 |
| commit | 5bab36e9f6c3f3a9e14a89e1124179a339d2c3a1 (patch) | |
| tree | a05154b129808efc7882599d96a1132051c2403b /src/backend/tcop/pquery.c | |
| parent | 90b3a0b6fd3bc74804c01156491635e5d95091d9 (diff) | |
| download | postgresql-5bab36e9f6c3f3a9e14a89e1124179a339d2c3a1.tar.gz | |
Revise executor APIs so that all per-query state structure is built in
a per-query memory context created by CreateExecutorState --- and destroyed
by FreeExecutorState. This provides a final solution to the longstanding
problem of memory leaked by various ExecEndNode calls.
Diffstat (limited to 'src/backend/tcop/pquery.c')
| -rw-r--r-- | src/backend/tcop/pquery.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c index 24d4aac8b2..1e02e42193 100644 --- a/src/backend/tcop/pquery.c +++ b/src/backend/tcop/pquery.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.57 2002/12/05 15:50:35 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.58 2002/12/15 16:17:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -52,6 +52,18 @@ CreateQueryDesc(Query *parsetree, return qd; } +/* + * FreeQueryDesc + */ +void +FreeQueryDesc(QueryDesc *qdesc) +{ + /* Can't be a live query */ + Assert(qdesc->estate == NULL); + /* Only the QueryDesc itself need be freed */ + pfree(qdesc); +} + /* ---------------- * PreparePortal * ---------------- @@ -152,9 +164,8 @@ ProcessQuery(Query *parsetree, * QueryDesc */ /* - * We stay in portal's memory context for now, so that query desc, - * exec state, and plan startup info are also allocated in the portal - * context. + * We stay in portal's memory context for now, so that query desc + * is also allocated in the portal context. */ } @@ -231,4 +242,6 @@ ProcessQuery(Query *parsetree, * Now, we close down all the scans and free allocated resources. */ ExecutorEnd(queryDesc); + + FreeQueryDesc(queryDesc); } |
