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

Matthias Otterbach <mo@otterbach.eu>

From: Matthias Otterbach <mo@otterbach.eu>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2019-03-18T18:39:32Z
Lists: pgsql-bugs

Attachments

Dear Jeff, dear pgsql-bugs list,

thanks for your reply.

Am 2019-03-18 19:15, schrieb Jeff Janes:
> On Mon, Mar 18, 2019 at 7:01 AM PG Bug reporting form
> <noreply@postgresql.org> wrote:
> 
>> The Java program actually just executes "SELECT b FROM public.a" and
>> keeps
>> streaming more rows doing something with the content, also the
>> execution
>> plan for my query is fairly simple - actually it seems to be just a
>> sequential scan (with both versions).
> 
> Could you include as an attachment a complete compilable java program?
>  Including the imports, the main public class definition, etc.

Of course that is possible, you find the program attached.

You should be able to compile and execute it using the following command 
lines (maybe change the host, username and password before compilation 
as they are unfortunately hard-coded currently):

- Compilation: /your/path/to/javac TestMemoryIssue.java
- Execution: /your/path/to/java -cp 
"/your/path/to/postgresql-42.2.5.jar;." TestMemoryIssue

If it matters, I used

openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

for compilation and execution of the program. But as the same program 
worked against a PG 10 database I suppose that the Java version should 
not matter.

Best regards,
Matthias Otterbach

Commits

  1. Fix memory leak in printtup.c.

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