Re: BUG #15700: PG 10 vs. 11: Large increase in memory usage when selecting BYTEA data (maybe memory leak)

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Jeff Janes <jeff.janes@gmail.com>, Matthias Otterbach <mo@otterbach.eu>, pgsql-bugs@lists.postgresql.org
Date: 2019-03-18T22:03:40Z
Lists: pgsql-bugs
Andres Freund <andres@anarazel.de> writes:
> But are we actually prepared to assume that nothing ever leaks in
> receivers? That's, as far as I can tell, not a documented
> assumption.

There's a lot that's not documented there :-(

> We're also assuming that we don't leak into MessageContext over such
> cycles, which seems wrong. At the very least things like
> errdetail_params() are happy to leak into MessageContext.

This leak isn't in MessageContext; if it were, there likely wouldn't
have been a noticeable problem.  It's leaking in the executor's
context over repeat ExecutorRun cycles in the same execution state.
We do have an expectation that there won't be per-row leakage in
the ExecutorState.

			regards, tom lane


Commits

  1. Fix memory leak in printtup.c.

  2. Use one stringbuffer for all rows printed in printtup.c.