pgsql: Reduce leakage during PL/pgSQL function compilation.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Reduce leakage during PL/pgSQL function compilation.
Дата
Msg-id E1uiO1p-000SoA-2t@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Reduce leakage during PL/pgSQL function compilation.

format_procedure leaks memory, so run it in a short-lived context
not the session-lifespan cache context for the PL/pgSQL function.

parse_datatype called the core parser in the function's cache context,
thus leaking potentially a lot of storage into that context.  We were
also being a bit careless with the TypeName structures made in that
code path and others.  Most of the time we don't need to retain the
TypeName, so make sure it is made in the short-lived temp context,
and copy it only if we do need to retain it.

These are far from the only leaks in PL/pgSQL compilation, but
they're the biggest as far as I've seen, and further improvement
looks like it'd require delicate and bug-prone surgery.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9f18fa9995628fef752d704d874eeed0bab815e5

Modified Files
--------------
src/pl/plpgsql/src/pl_comp.c | 28 ++++++++++++++++++++++------
src/pl/plpgsql/src/pl_gram.y |  8 +++++++-
2 files changed, 29 insertions(+), 7 deletions(-)


В списке pgsql-committers по дате отправления: