plug-foreign-scan-memory-leak-1.patch
text/x-diff
Filename: plug-foreign-scan-memory-leak-1.patch
Type: text/x-diff
Part: 0
Message:
Memory leak in FDW
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/executor/nodeForeignscan.c | 5 | 1 |
diff --git a/src/backend/executor/nodeForeignscan.c b/src/backend/executor/nodeForeignscan.c index d50489c..2e36da0 100644 --- a/src/backend/executor/nodeForeignscan.c +++ b/src/backend/executor/nodeForeignscan.c @@ -44,7 +44,11 @@ ForeignNext(ForeignScanState *node) ExprContext *econtext = node->ss.ps.ps_ExprContext; MemoryContext oldcontext; - /* Call the Iterate function in short-lived context */ + /* + * Call the Iterate function in short-lived context. Reset it first + * to free any leftovers from previous iteration. + */ + ResetExprContext(econtext); oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory); slot = node->fdwroutine->IterateForeignScan(node); MemoryContextSwitchTo(oldcontext);