diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-12-01 13:44:47 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-12-01 13:44:47 -0500 |
commit | 5cf08b4db79d6e3a82c4b92f8c9cf35e87c70d01 (patch) | |
tree | f29677bc4ee9c6c5afdf6371053773d3ee9d530e /src/backend/access/transam/commit_ts.c | |
parent | 2f908e1a3b9c07e43d3ad9ebe6633fae1ed355e3 (diff) | |
download | postgresql-5cf08b4db79d6e3a82c4b92f8c9cf35e87c70d01.tar.gz postgresql-5cf08b4db79d6e3a82c4b92f8c9cf35e87c70d01.zip |
Avoid leaking memory during large-scale REASSIGN OWNED BY operations.
The various ALTER OWNER routines tend to leak memory in
CurrentMemoryContext. That's not a problem when they're only called
once per command; but in this usage where we might be touching many
objects, it can amount to a serious memory leak. Fix that by running
each call in a short-lived context.
(DROP OWNED BY likely has a similar issue, except that you'll probably
run out of lock table space before noticing. REASSIGN is worth fixing
since for most non-table object types, it won't take any lock.)
Back-patch to all supported branches. Unfortunately, in the back
branches this helps to only a limited extent, since the sinval message
queue bloats quite a lot in this usage before commit 3aafc030a,
consuming memory more or less comparable to what's actually leaked.
Still, it's clearly a leak with a simple fix, so we might as well fix it.
Justin Pryzby, per report from Guillaume Lelarge
Discussion: https://postgr.es/m/CAECtzeW2DAoioEGBRjR=CzHP6TdL=yosGku8qZxfX9hhtrBB0Q@mail.gmail.com
Diffstat (limited to 'src/backend/access/transam/commit_ts.c')
0 files changed, 0 insertions, 0 deletions