From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow repalloc() to give back space when a large chunk is downsi
Date: Thu, 03 Oct 2019 17:56:49 +0000
Message-ID: <E1iG5LN-0006Lo-Le@gemulon.postgresql.org> (raw)
Allow repalloc() to give back space when a large chunk is downsized.
Up to now, if you resized a large (>8K) palloc chunk down to a smaller
size, aset.c made no attempt to return any space to the malloc pool.
That's unpleasant if a really large allocation is resized to a
significantly smaller size. I think no such cases existed when this
code was designed, and I'm not sure whether they're common even yet,
but an upcoming fix to encoding conversion will certainly create such
cases. Therefore, fix AllocSetRealloc so that it gives realloc()
a chance to do something with the block. This doesn't noticeably
increase complexity, we mostly just have to change the order in which
the cases are considered.
Back-patch to all supported branches.
Discussion: https://postgr.es/m/20190816181418.GA898@alvherre.pgsql
Discussion: https://postgr.es/m/3614.1569359690@sss.pgh.pa.us
Branch
------
REL9_5_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/1534531fe74fbc8195eced110f61ab2ce89271a1
Modified Files
--------------
src/backend/utils/mmgr/aset.c | 140 +++++++++++++++++++++++-------------------
1 file changed, 76 insertions(+), 64 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Allow repalloc() to give back space when a large chunk is downsi
In-Reply-To: <E1iG5LN-0006Lo-Le@gemulon.postgresql.org>
References: <E1iG5LN-0006Lo-Le@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox