model-writtenrun 4061 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Lauri Laanmets reported that repeatedly executing a query with two scalar subqueries caused backend memory growth invisible to PostgreSQL memory-context accounting and eventually triggered the OOM killer on Linux #1.
- David Rowley suggested disabling JIT #4, Tom Lane reproduced the leak with a JIT-enabled build and identified inlining as a difference between the one- and two-subquery plans #5 #7, and Lauri later confirmed that disabling JIT stopped the leak #11.
- David also reported a crash without JIT inlining or optimization #8, but Tom observed only slow leakage and suspected a different problem or LLVM-version dependence #9; Justin Pryzby later requested crash details and patched-versus-unpatched testing, without a recorded resolution of that separate symptom #12.
- Andres Freund supplied a four-patch series using explicit LLVM contexts and periodically recreating them to release accumulated types, alongside two independent cleanups; benchmarking supported reducing the recycling interval to 100 uses for this more aggressive reproducer #10.
- After several months, Daniel Gustafsson tested and reviewed the series, questioned its stale interval description and unused context member, and added helper extraction and naming fixes #13; his next revision corrected counter handling and showed memory growth levelling off, while raising the possibility of a configurable recycling threshold #14.
- Daniel returned with a rebased three-patch series that kept the two cleanups separate and combined the context work and review fixes, reporting bounded memory usage under repeated execution and proposing an early PostgreSQL 17 landing #15.
- The two cleanup patches from #15 landed unchanged as 2dad308e73, removing unused types, and ef668d8bf5, making llvm_types_module private.
- The combined context-recycling patch from #15 landed with its code unchanged as 9dce22033d; Daniel reported an off-list endorsement from co-author Andres, further read-throughs, JIT-enabled check-world runs, and successful buildfarm results #16.
- Daniel ultimately confirmed that the leak fix and a prerequisite needed by older releases had been backpatched to all supported branches with successful LLVM-enabled buildfarm runs #18; the submitted series was fully landed, while finer-grained recycling remained future work described in #15.