diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-29 17:14:33 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-29 17:14:33 +0000 |
commit | e4186762ffaa4188e16702e8f4f299ea70988b96 (patch) | |
tree | 2ee78b84ead113ad17b029743432c24a37a362f9 /src/backend/executor/nodeFunctionscan.c | |
parent | 0201dac1c319599aad3feb752d7ee5162200e2c7 (diff) | |
download | postgresql-e4186762ffaa4188e16702e8f4f299ea70988b96.tar.gz postgresql-e4186762ffaa4188e16702e8f4f299ea70988b96.zip |
Adjust nodeFunctionscan.c to reset transient memory context between calls
to the table function, thus preventing memory leakage accumulation across
calls. This means that SRFs need to be careful to distinguish permanent
and local storage; adjust code and documentation accordingly. Patch by
Joe Conway, very minor tweaks by Tom Lane.
Diffstat (limited to 'src/backend/executor/nodeFunctionscan.c')
-rw-r--r-- | src/backend/executor/nodeFunctionscan.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/executor/nodeFunctionscan.c b/src/backend/executor/nodeFunctionscan.c index 381b6047bf0..d58d312238e 100644 --- a/src/backend/executor/nodeFunctionscan.c +++ b/src/backend/executor/nodeFunctionscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.6 2002/08/29 00:17:04 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.7 2002/08/29 17:14:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -429,6 +429,12 @@ function_getonetuple(FunctionScanState *scanstate, TupleTableSlot *slot = scanstate->csstate.css_ScanTupleSlot; /* + * reset per-tuple memory context before each call of the function. + * This cleans up any local memory the function may leak when called. + */ + ResetExprContext(econtext); + + /* * get the next Datum from the function */ retDatum = ExecEvalExprSwitchContext(expr, econtext, isNull, isDone); |