postgresql/src/backend/access
Tom Lane 696b0c5fd0 Fix memory leak in repeated SPGIST index scans.
spgendscan neglected to pfree all the memory allocated by spgbeginscan.
It's possible to get away with that in most normal queries, since the
memory is allocated in the executor's per-query context which is about
to get deleted anyway; but it causes severe memory leakage during
creation or filling of large exclusion-constraint indexes.

Also, document that amendscan is supposed to free what ambeginscan
allocates.  The docs' lack of clarity on that point probably caused this
bug to begin with.  (There is discussion of changing that API spec going
forward, but I don't think it'd be appropriate for the back branches.)

Per report from Bruno Wolff.  It's been like this since the beginning,
so back-patch to all active branches.

In HEAD, also fix an independent leak caused by commit 2a6368343
(allocating memory during spgrescan instead of spgbeginscan, which
might be all right if it got cleaned up, but it didn't).  And do a bit
of code beautification on that commit, too.

Discussion: https://postgr.es/m/20181024012314.GA27428@wolff.to
2018-10-31 17:05:03 -04:00
..
brin Fail BRIN control functions during recovery explicitly 2018-06-14 12:51:32 -04:00
common Correctly set t_self for heap tuples in expand_tuple 2018-10-24 10:56:27 -04:00
gin Fix past pd_upper write in ginRedoRecompress() 2018-09-09 21:19:29 +03:00
gist Add support for nearest-neighbor (KNN) searches to SP-GiST 2018-09-19 01:54:10 +03:00
hash Remove deprecated abstime, reltime, tinterval datatypes. 2018-10-11 11:59:15 -07:00
heap Fix logical decoding error when system table w/ toast is repeatedly rewritten. 2018-10-10 13:53:02 -07:00
index Add support for nearest-neighbor (KNN) searches to SP-GiST 2018-09-19 01:54:10 +03:00
nbtree Allow btree comparison functions to return INT_MIN. 2018-10-05 16:01:29 -04:00
rmgrdesc printf("%lf") is not portable, so omit the "l". 2018-05-20 11:40:54 -04:00
spgist Fix memory leak in repeated SPGIST index scans. 2018-10-31 17:05:03 -04:00
tablesample Rethink how to get float.h in old Windows API for isnan/isinf 2018-07-11 09:11:48 -04:00
transam Fix typo in xlog.c. 2018-10-31 07:50:32 -07:00
Makefile TABLESAMPLE, SQL Standard and extensible 2015-05-15 14:37:10 -04:00