Re: psql leaks memory on query cancellation

From: Darafei "Komяpa" Praliaskouski <me(at)komzpa(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: psql leaks memory on query cancellation
Date: 2018-04-23 14:32:49
Message-ID: CAC8Q8t+Hb4pjb0QG6vJT7wNNz1-2QuZ-VZ=Tv8vZ7j1pZAoCrw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Therefore, I propose the attached patch, which simply sees to it that
> we discard any partial query result at the start of error message
> collection not the end. This makes the behavior very much better,
> at least on Linux.
>

I have tested the build of Postgres with attached patch and confirm that I
don't see this problematic behavior anymore even with default allocator.
Thank you!

I think this is a back-patchable bug fix; certainly so at least back
> to 9.6 where \errverbose was added. Versions before that do not show
> the persistent memory bloat the OP is complaining of, so that what
> we have here is arguably a performance regression. Comments?
>

This should not bring regression, since the memory is freed anyway, but is
valuable as puts less pressure on client memory requirements for manual
data inspection workflows.

Darafei Praliaskouski,
GIS Engineer / Juno Minsk

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-04-23 14:38:36 Re: Is a modern build system acceptable for older platforms
Previous Message Amit Langote 2018-04-23 13:15:47 Re: minor fix for acquire_inherited_sample_rows