Re: psql leaks memory on query cancellation
Teodor Sigaev <teodor@sigaev.ru>
From: Teodor Sigaev <teodor@sigaev.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>, Craig Ringer <craig@2ndquadrant.com>
Cc: Darafei Komяpa Praliaskouski <me@komzpa.net>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2018-04-12T18:23:29Z
Lists: pgsql-hackers
> I imagine that this indicates that control-C processing allocates some
> memory it doesn't free, resulting in an "island" up at the end of memory
> that prevents glibc from releasing all the free memory it's got. Whether
> that's an actual leak, or just memory we're holding onto in hopes of
> reusing it, isn't clear. (valgrind might be useful.)
malloc could request memory from kernel by two ways: sbrk() and mmap(),
first one has described problem, mmap hasn't. It's described in
mallopt(3) in section M_MMAP_THRESHOLD, to test that try to repeat test
with MALLOC_MMAP_THRESHOLD_ environment set to 8192.
--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/
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