postgresql/src/backend
Tom Lane 407b50f2d4 Store GUC data in a memory context, instead of using malloc().
The only real argument for using malloc directly was that we needed
the ability to not throw error on OOM; but mcxt.c grew that feature
awhile ago.

Keeping the data in a memory context improves accountability and
debuggability --- for example, without this it's almost impossible
to detect memory leaks in the GUC code with anything less costly
than valgrind.  Moreover, the next patch in this series will add a
hash table for GUC lookup, and it'd be pretty silly to be using
palloc-dependent hash facilities alongside malloc'd storage of the
underlying data.

This is a bit invasive though, in particular causing an API break
for GUC check hooks that want to modify the GUC's value or use an
"extra" data structure.  They must now use guc_malloc() and
guc_free() instead of malloc() and free().  Failure to change
affected code will result in assertion failures or worse; but
thanks to recent effort in the mcxt infrastructure, it shouldn't
be too hard to diagnose such oversights (at least in assert-enabled
builds).

One note is that this changes ParseLongOption() to return short-lived
palloc'd not malloc'd data.  There wasn't any caller for which the
previous definition was better.

Discussion: https://postgr.es/m/2982579.1662416866@sss.pgh.pa.us
2022-10-14 12:10:48 -04:00
..
access Fix ordering issue with WAL operations in GIN fast insert path 2022-10-13 09:31:57 +09:00
backup Rename shadowed local variables 2022-10-05 21:01:41 +13:00
bootstrap Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
catalog Fix self-referencing foreign keys with partitioned tables 2022-10-07 19:37:48 +02:00
commands Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
executor Remove unnecessary semicolons after goto labels 2022-10-10 15:08:38 +07:00
foreign meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
jit meson: Add windows resource files 2022-10-05 09:56:05 -07:00
lib meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
libpq meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
main meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
nodes Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
optimizer Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
parser Rename shadowed local variables 2022-10-05 21:01:41 +13:00
partitioning Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
po meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
port meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
postmaster Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
regex Remove uses of register due to incompatibility with C++17 and up 2022-09-24 12:08:37 -07:00
replication Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
rewrite Yet further fixes for multi-row VALUES lists for updatable views. 2022-10-11 18:24:14 -04:00
snowball meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
statistics Rename shadowed local variables 2022-10-05 21:01:41 +13:00
storage Standardize format for printing PIDs 2022-10-14 08:38:53 +02:00
tcop Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
tsearch Introduce t_isalnum() to replace t_isalpha() || t_isdigit() tests. 2022-10-06 11:08:56 -04:00
utils Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Move gramparse.h to src/backend/parser 2022-09-14 10:57:13 +07:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
meson.build meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
nls.mk NLS: Put list of available languages into LINGUAS files 2022-07-13 08:19:17 +02:00