model-writtenrun 9123 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alvaro Herrera reported that encoding conversion rejected large XML output because allocating four times the input size exceeded the ordinary 1 GB allocation limit, and proposed huge allocations while acknowledging the missing overflow check #1.
- Tom Lane warned that returning strings larger than 1 GB could break callers and proposed measuring conversion output before allocating it #3; Andres Freund instead suggested accumulating output in separate chunks and combining them only when necessary #4.
- Tom Lane abandoned the measurement pass because it would change the conversion API and add inner-loop overhead, then posted a revision retaining Alvaro Herrera’s huge allocations while restoring overflow protection, limiting actual results to MaxAllocSize, and shrinking large output buffers #5.
- Testing revealed that AllocSetRealloc did not release memory when shrinking allocations, so Tom Lane included a second patch that handles large blocks before the early return for already-sufficient allocations #5.
- Andres Freund developed a StringInfo-based alternative intended to avoid over-allocation and extra strlen and memcpy operations #6, but Tom Lane objected to its implementation cost, API breakage, and possible conversion overhead #7; Andres maintained that avoiding caller-side work could improve performance #8.
- Tom Lane committed the allocator portion of #5 with light edits as c477f3e449, then committed its unchanged encoding-conversion portion as 8e10405c74, with both changes backpatched to supported branches.
- Tom Lane announced that both patches were pushed and the CommitFest entry was closed, leaving further improvements to Andres Freund #9; Alvaro Herrera thanked him in the final reply #10.