model-writtenrun 8997 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Ben Cornett reported that a lateral UNNEST query consumed nearly 1 GB of memory, with consumption growing with the input row count #1.
- Tomas Vondra reproduced the leak, traced it to FunctionCallInfo allocation in a query-lifetime context, and posted a patch explicitly freeing that allocation when ExecMakeTableFunctionResult() returns #2.
- Andres Freund advocated memory-context cleanup to protect against other temporary allocations #3; after Tom Lane questioned introducing a private context #4, Andres identified the existing argContext as having the required lifetime #6, which Tom supported #7.
- Jeff Janes confirmed that Tomas's patch fixed the leak on PostgreSQL 12 but reported an earlier apparent origin #8; Andres suggested overlapping tuple-slot leaks and explained why ordinary regression tests were unlikely to expose this repeated-function-scan memory growth #9.
- Andres posted a replacement patch that performs per-set initialization in argContext and resets it between executions; he considered renaming the context but left its name unchanged #11.
- After nearly five months without a commit, Ben asked whether the fix had landed #12, Tomas noted another missed minor release #13, and Andres acknowledged losing track of the patch and selected his context-based version for commit #14.
- Tom assessed the replacement patch as reasonable without testing it #15, and Andres committed #11 with light declaration and whitespace edits as 299298bc87, including a PostgreSQL 12 backport.
- Andres closed the thread by confirming the push and thanking Ben for the report; the context-based fix had landed, superseding the original explicit-free patch #16.