model-writtenrun 5926 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Guillaume Lelarge reported that reassigning many large objects could exhaust memory and get the backend killed, supplying a million-object reproducer and noting that memory was released only when reassignment finished #1.
- Justin Pryzby reproduced the growth and proposed an inline patch using a short-lived memory context per object #2; Tom Lane traced substantial leakage to executor index-update allocations and favored cleanup inside REASSIGN OWNED's loop because ALTER OWNER could leak elsewhere too #3.
- Guillaume attached his PostgreSQL 14 adaptation of Justin's patch after finding it ineffective #4; Tom corrected context creation around skipped dependencies and moved cleanup before the command-counter increment, while observing that DROP OWNED exhausted lock-table space before its analogous memory issue became interesting #5.
- Guillaume initially still measured roughly 1 GB with the revised patch on PostgreSQL 14 #6, but Tom's development-branch test stayed below 190 MB #7, and Guillaume confirmed that the patch worked there #8.
- Tom attributed the remaining PostgreSQL 14 growth to its bulkier pending invalidation queue and expressed concern about backpatching the separate queue optimization #11; Justin's checks of other bulk DDL commands found no significant additional issue #12.
- Guillaume's four-way comparison showed that the revised patch and the existing development-branch queue optimization together reduced peak memory from roughly 1 GB to 180 MB; his attempt to apply the queue optimization to PostgreSQL 14 encountered conflicts #13.
- Tom committed #5 with added comments and declaration formatting as babe545cae, crediting Justin and backpatching the leak fix to all supported branches; he explicitly acknowledged that invalidation queue growth still limited the improvement on older branches #14.
- The thread ended with Guillaume's thanks after the leak fix landed, leaving the older branches' invalidation queue growth unresolved in this thread #15.