model-writtenrun 4262 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Laurenz Albe reported incremental-sort rescan memory leaks with a reproducer and proposed an inline fix that destroyed sort states before discarding their pointers in #1; Tomas Vondra initially supported that approach while considering whether a separate flag could permit reuse in #2.
- Tom Lane found that Laurenz's fix still leaked presorted-key data and supplied an attached patch preserving that data and guarding its initialization, reporting zero leakage in his example in #3.
- Tomas Vondra offered to finish the fix in #4, Tom Lane handed it over in #5, and Tomas accepted in #6.
- James Coleman simplified the fix in #7 by retaining the reset sort-state pointers and presorted keys, allowing the existing initialization guard to prevent repeated allocation and avoiding the earlier proposal's destruction and recreation of sort states.
- After Laurenz Albe requested inclusion in the next minor release in #8, Tomas Vondra committed James's patch unchanged as 98640f960e, crediting James, Laurenz, and Tom as authors and backpatching through PostgreSQL 13.
- Tomas Vondra announced the completed push in #9, and Laurenz Albe acknowledged it in #10, closing the thread with the fix landed and no outstanding work stated.