From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: GetSubscription(): use per-object memory context.
Date: Tue, 24 Mar 2026 22:11:57 +0000
Message-ID: <E1w59yf-001IlL-03@gemulon.postgresql.org> (raw)
GetSubscription(): use per-object memory context.
Constructing a Subcription object uses a number of small or temporary
allocations. Use a per-object memory context for easy cleanup.
Get rid of FreeSubscription() which did not free all the allocations
anyway. Also get rid of the PG_TRY()/PG_CATCH() logic in
ForeignServerConnectionString() which were used to avoid leaks during
GetSubscription().
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Suggested-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/xvdjrdqnpap3uq7owbaox3r7p5gf7sv62aaqf2ju3vb6yglatr%40kvvwhoudrlxq
Discussion: https://postgr.es/m/CAA4eK1K=WjZ1maBCmj=5ZdO66AwPORK5ZBxVKedS0xdCcb621A@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f16f5d608ca6830f452a3b1e9f72afc6851cab38
Modified Files
--------------
src/backend/catalog/pg_subscription.c | 24 +++++-------
src/backend/foreign/foreign.c | 66 +++++++++-----------------------
src/backend/replication/logical/worker.c | 36 ++++++++---------
src/include/catalog/pg_subscription.h | 3 +-
4 files changed, 48 insertions(+), 81 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 using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: GetSubscription(): use per-object memory context.
In-Reply-To: <E1w59yf-001IlL-03@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