Re: allocation limit for encoding conversion
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>,
pgsql-hackers@lists.postgresql.org
Date: 2019-09-24T22:09:28Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes: > On 2019-09-24 16:19:41 -0400, Tom Lane wrote: >> Andres Freund <andres@anarazel.de> writes: >>> It's probably too big a hammer for this specific case, but I think at >>> some point we ought to stop using fixed size allocations for this kind >>> of work. Instead we should use something roughly like our StringInfo, >>> except that when exceeding the current size limit, the overflowing data >>> is stored in a separate allocation. And only once we actually need the >>> data in a consecutive form, we allocate memory that's large enough to >>> store the all the separate allocations in their entirety. >> That sounds pretty messy :-(. > I don't think it's too bad - except for now allowing the .data member of > such a 'chunked' StringInfo to be directly accessible, it'd be just > about the same interface as the current stringinfo. I dunno. What you're describing would be a whole lotta work, and it'd break a user-visible API, and no amount of finagling is going to prevent it from making conversions somewhat slower, and the cases where it matters to not preallocate a surely-large-enough buffer are really few and far between. I have to think that we have better ways to spend our time. regards, tom lane
Commits
-
Avoid unnecessary out-of-memory errors during encoding conversion.
- 6899be28908a 9.4.25 landed
- 677989cc0107 9.6.16 landed
- 54d641da0640 9.5.20 landed
- 226551e7c385 10.11 landed
- e5ff9757194b 11.6 landed
- 8e10405c7450 13.0 landed
- 8381242df587 12.1 landed
-
Allow repalloc() to give back space when a large chunk is downsized.
- 4829576ba44b 9.4.25 landed
- e5e4f12a5f85 9.6.16 landed
- c477f3e449d1 13.0 landed
- 9ad1b572d8b7 10.11 landed
- 9a407209a075 12.1 landed
- 82d0a46ea32d 11.6 landed
- 1534531fe74f 9.5.20 landed