pgsql: Avoid useless palloc during transaction commit

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid useless palloc during transaction commit
Date: 2013-12-20 15:43:19
Message-ID: E1Vu2ER-00046X-Fs@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid useless palloc during transaction commit

We can allocate the initial relations-to-drop array when first needed,
instead of at function entry; this avoids allocating it when the
function is not going to do anything, which is most of the time.

Backpatch to 9.3, where this behavior was introduced by commit
279628a0a7cf5.

There's more that could be done here, such as possible reworking of the
code to avoid having to palloc anything, but that doesn't sound as
backpatchable as this relatively minor change.

Per complaint from Noah Misch in
20131031145234(dot)GA621493(at)tornado(dot)leadboat(dot)com

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/fd995b3f4fe52ecd45d06f8cb8b9d217298df917

Modified Files
--------------
src/backend/catalog/storage.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2013-12-20 18:33:47 pgsql: Rename wal_log_hintbits to wal_log_hints, per discussion on pgsq
Previous Message Alvaro Herrera 2013-12-20 14:39:33 Re: pgsql: Upgrade to Autoconf 2.69