model-writtenrun 6125 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Chao Li reported in #1 that three lsyscache.c functions repeatedly obtained IndexAmRoutine objects without freeing them, unlike get_opmethod_canorder(), and described the practical impact as small.
- The patch in #1 copied the needed boolean fields into local variables and freed each routine before continuing, seeking consistent ownership handling without functional changes.
- Tom Lane proposed returning static constant routines to avoid allocation overhead in #2, and Matthias van de Meent supplied an existing implementation in #3 that also saved 264 bytes per cached index.
- Tom clarified in #4 that extensions could still construct a routine in a long-lived context for per-session specialization, requested documentation, and supplied an rd_indexcxt context-switch safeguard for older allocating handlers in #5.
- Matthias incorporated the documentation and compatibility safeguard in #6, after which Tom posted #7 with mostly cosmetic cleanup, fuller lifetime documentation, const corrections, and simpler callers.
- Chao accepted that the replacement superseded his original patch in #8, identified stale comments and a missing const qualifier already corrected by #7, and questioned whether the compatibility safeguard could protect every external AM in #9.
- Matthias favored best-effort compatibility in #10, and Tom explained in #11 that the context switch prevents dangling pointers for ordinary legacy handlers; Tom also reported that check-world passed with the old allocating handlers retained.
- Alvaro Herrera tried allocation-growth warnings in #12, but AllocSet accounting obscured small allocations; Matthias proposed consumed-memory assertions in #13, which Tom rejected in #14 because incidental fmgr and syscache allocations could cause false positives.
- Matthias accepted leaving allocation checks out and approved the final patch in #15, and Tom announced that he had pushed it in #16.
- The subsequent trailer-linked bc6374cd76, authored by Matthias van de Meent and committed by Tom Lane, addressed the problem through permanently allocated routines, eliminating repeated allocation and relcache copies while documenting an extension API change.
- After announcing the push in #16, Tom outlined a possible memory-context pointer-membership check but declined to pursue it because of potential false positives and implementation effort.
- The replacement had landed by the thread's final message, #17, where Andres Freund welcomed the memory and CPU savings; stricter allocation enforcement remained an unimplemented possibility.