pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: Matthias Otterbach <mo@otterbach.eu>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15700: PG 10 vs. 11: Large increase in memory usage when selecting BYTEA data (maybe memory leak)
Date: Mon, 18 Mar 2019 17:37:41 -0400
Message-ID: <16692.1552945061@sss.pgh.pa.us> (raw)
In-Reply-To: <13467.1552942521@sss.pgh.pa.us>
References: <15700-8c408321a87d56bb@postgresql.org>
	<16717.1552926811@sss.pgh.pa.us>
	<4ef5f38d5710c4d5c289537c588c7335@otterbach.eu>
	<CAMkU=1wW32K8n4ut_7zz+6HH1J068tFtpv5os=eeAgvjiQH8ZQ@mail.gmail.com>
	<CAMkU=1x_XySqXZ-1gCyoaipKLzefQSr1BuaHL12vy_9WKFnjYQ@mail.gmail.com>
	<13467.1552942521@sss.pgh.pa.us>

I wrote:
> Jeff Janes <jeff.janes@gmail.com> writes:
>> The culprit is f2dec34e19d3969ddd6.

> Hmm.  I bet problem is that the buf isn't being freed in
> printtup_shutdown.

Yup; the attached fixes it.  Will push after a bit more testing.

			regards, tom lane

Attachments:

fix-printtup-leak.patch (text/x-diff, 749B) download diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index e4ee5c9..5eb928b 100644 *** a/src/backend/access/common/printtup.c --- b/src/backend/access/common/printtup.c *************** printtup_create_DR(CommandDest dest) *** 91,96 **** --- 91,97 ---- */ self->sendDescrip = (dest == DestRemote); + self->buf.data = NULL; self->attrinfo = NULL; self->nattrs = 0; self->myinfo = NULL; *************** printtup_shutdown(DestReceiver *self) *** 547,552 **** --- 548,557 ---- if (myState->tmpcontext) MemoryContextDelete(myState->tmpcontext); myState->tmpcontext = NULL; + + if (myState->buf.data) + pfree(myState->buf.data); + myState->buf.data = NULL; } /* ----------------

view thread (16+ messages)  latest in thread

Message-ID: <16692.1552945061@sss.pgh.pa.us>
Permalink:  ../16692.1552945061@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16692.1552945061@sss.pgh.pa.us

 ·  · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, jeff.janes@gmail.com, mo@otterbach.eu, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15700: PG 10 vs. 11: Large increase in memory usage when selecting BYTEA data (maybe memory leak)
  In-Reply-To: <16692.1552945061@sss.pgh.pa.us>

* 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