postgresql/src
Andres Freund 84ad4b036d Reduce memory usage of targetlist SRFs.
Previously nodeProjectSet only released memory once per input tuple,
rather than once per returned tuple. If the computation of an
individual returned tuple requires a lot of memory, that can lead to
problems.

Instead change things so that the expression context can be reset once
per output tuple, which requires a new memory context to store SRF
arguments in.

This is a longstanding issue, but was hard to fix before 9.6, due to
the way tSRFs where evaluated. But it's fairly easy to fix now. We
could backpatch this into 10, but given there've been fewc omplaints
that doesn't seem worth the risk so far.

Reported-By: Lucas Fairchild
Author: Andres Freund, per discussion with Tom Lane
Discussion: https://postgr.es/m/4514.1507318623@sss.pgh.pa.us
2017-10-08 15:08:25 -07:00
..
backend Reduce memory usage of targetlist SRFs. 2017-10-08 15:08:25 -07:00
bin #ifdef out some dead code in psql/mainloop.c. 2017-10-06 11:35:55 -04:00
common Replace most usages of ntoh[ls] and hton[sl] with pg_bswap.h. 2017-10-01 15:36:14 -07:00
fe_utils Provide a test for variable existence in psql 2017-09-21 19:02:23 -04:00
include Reduce memory usage of targetlist SRFs. 2017-10-08 15:08:25 -07:00
interfaces Replace most usages of ntoh[ls] and hton[sl] with pg_bswap.h. 2017-10-01 15:36:14 -07:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:55 -04:00
pl Use Py_RETURN_NONE where suitable 2017-09-29 16:51:39 -04:00
port Yet another pg_bswap typo in a windows only file. 2017-10-01 20:05:27 -07:00
template Remove "sco" and "unixware" ports. 2016-10-11 11:26:04 -04:00
test Reduce "X = X" to "X IS NOT NULL", if it's easy to do so. 2017-10-08 12:23:32 -04:00
timezone Sync our copy of the timezone library with IANA tzcode master. 2017-09-22 00:04:29 -04:00
tools Enforce our convention about max number of parallel regression tests. 2017-10-07 17:20:09 -04:00
tutorial Distinguish selectivity of < from <= and > from >=. 2017-09-13 11:12:39 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Remove redundant coverage target 2017-02-17 08:56:57 -05:00
Makefile.global.in Support coverage on vpath builds 2017-10-06 11:39:46 -04:00
Makefile.shlib Remove support for bcc and msvc standalone libpq builds 2017-04-11 15:22:21 +02:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00