Re: psql leaks memory on query cancellation
Darafei Komяpa Praliaskouski <me@komzpa.net>
From: Darafei "Komяpa" Praliaskouski <me@komzpa.net>
To: Craig Ringer <craig@2ndquadrant.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2018-04-12T12:37:54Z
Lists: pgsql-hackers
> > > > Is it expected behavior (so I can have a look at something server > returned > > somehow and it's kept there for me), or a plain leak? > > This is totally normal behaviour for any C program. > Thanks Konstantin and Craig for the help. To mitigate the issue I've changed the allocator on my laptop to jemalloc. For single psql run on my Ubuntu system: sudo apt install libjemalloc1 LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 psql A global replacement by putting /usr/lib/x86_64-linux-gnu/libjemalloc.so.1 to /etc/ld.so.preload also had a positive effect fixing this behavior in all the applications, reducing after-boot memory footprint from 7 GB to 3. 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