aboutsummaryrefslogtreecommitdiff
path: root/contrib/jsonb_plpython/sql
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2024-03-08 13:01:36 +0200
committerAlexander Korotkov <akorotkov@postgresql.org>2024-03-08 13:18:30 +0200
commit4c1973fcaecd9ef11de14ac55d3ec1432f6b82dc (patch)
tree416e9819e0513dcd2a9a1020aaa9b1230ba6763a /contrib/jsonb_plpython/sql
parent6f38c43eb135f5d6b873924180562d8334d6e31d (diff)
downloadpostgresql-4c1973fcaecd9ef11de14ac55d3ec1432f6b82dc.tar.gz
postgresql-4c1973fcaecd9ef11de14ac55d3ec1432f6b82dc.zip
Avoid recursion in MemoryContext functions
You might run out of stack space with recursion, which is not nice in functions that might be used e.g. at cleanup after transaction abort. MemoryContext contains pointer to parent and siblings, so we can traverse a tree of contexts iteratively, without using stack. Refactor the functions to do that. MemoryContextStats() still recurses, but it now has a limit to how deep it recurses. Once the limit is reached, it prints just a summary of the rest of the hierarchy, similar to how it summarizes contexts with lots of children. That seems good anyway, because a context dump with hundreds of nested contexts isn't very readable. Report by Egor Chindyaskin and Alexander Lakhin. Discussion: https://postgr.es/m/1672760457.940462079%40f306.i.mail.ru Author: Heikki Linnakangas Reviewed-by: Robert Haas, Andres Freund, Alexander Korotkov, Tom Lane
Diffstat (limited to 'contrib/jsonb_plpython/sql')
0 files changed, 0 insertions, 0 deletions