pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix memory leak in printtup.c.
Date: Mon, 18 Mar 2019 21:55:11 +0000
Message-ID: <E1h60Dv-0008Gm-0k@gemulon.postgresql.org> (raw)

Fix memory leak in printtup.c.

Commit f2dec34e1 changed things so that printtup's output stringinfo
buffer was allocated outside the per-row temporary context, not inside
it.  This creates a need to free that buffer explicitly when the temp
context is freed, but that was overlooked.  In most cases, this is all
happening inside a portal or executor context that will go away shortly
anyhow, but that's not always true.  Notably, the stringinfo ends up
getting leaked when JDBC uses row-at-a-time fetches.  For a query
that returns wide rows, that adds up after awhile.

Per bug #15700 from Matthias Otterbach.  Back-patch to v11 where the
faulty code was added.

Discussion: https://postgr.es/m/15700-8c408321a87d56bb@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f2004f19ed9c9228d3ea2b12379ccb4b9212641f

Modified Files
--------------
src/backend/access/common/printtup.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1h60Dv-0008Gm-0k@gemulon.postgresql.org>
Permalink:  ../E1h60Dv-0008Gm-0k@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1h60Dv-0008Gm-0k@gemulon.postgresql.org

 · 

reply

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: Fix memory leak in printtup.c.
  In-Reply-To: <E1h60Dv-0008Gm-0k@gemulon.postgresql.org>
  References: <E1h60Dv-0008Gm-0k@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