Re: psql leaks memory on query cancellation - Mailing list pgsql-hackers

From Darafei "Komяpa" Praliaskouski
Subject Re: psql leaks memory on query cancellation
Date
Msg-id CAC8Q8t+Hb4pjb0QG6vJT7wNNz1-2QuZ-VZ=Tv8vZ7j1pZAoCrw@mail.gmail.com
Whole thread Raw
In response to Re: psql leaks memory on query cancellation  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: minor fix for acquire_inherited_sample_rows
Next
From: Robert Haas
Date:
Subject: Re: Is a modern build system acceptable for older platforms