Re: psql leaks memory on query cancellation
Darafei Komяpa Praliaskouski <me@komzpa.net>
From: Darafei "Komяpa" Praliaskouski <me@komzpa.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Craig Ringer <craig@2ndquadrant.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2018-04-23T14:32:49Z
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
Commits
-
In libpq, free any partial query result before collecting a server error.
- bbec33c2d026 9.3.23 landed
- 3dd36aa4b36c 9.4.18 landed
- 2278e94ae941 9.5.13 landed
- 131f6a958360 9.6.9 landed
- d25c2ee9c038 11.0 landed
- d014b38df60f 10.4 landed