Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1c1294b

Browse files
committed
Prevent long-term memory leakage in autovacuum launcher.
get_database_list() failed to restore the caller's memory context,instead leaving current context set to TopMemoryContext which ishow CommitTransactionCommand() leaves it. The callers both thinkthey are using short-lived contexts, for the express purpose ofnot having to worry about cleaning up individual allocations.The net effect therefore is that supposedly short-lived allocationscould accumulate indefinitely in the launcher's TopMemoryContext.Although this has been broken for a long time, it seems we didn'thave any obvious memory leak here until v15's rearrangement of thestats logic. I (tgl) am not entirely convinced that there's noother leak at all, though, and we're surely at risk of adding onein future back-patched fixes. So back-patch to all supportedbranches, even though this may be only a latent bug in pre-v15.Reid ThompsonDiscussion:https://postgr.es/m/972a4e12b68b0f96db514777a150ceef7dcd2e0f.camel@crunchydata.com
1 parentc3ffa73 commit1c1294b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎src/backend/postmaster/autovacuum.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,6 +1941,9 @@ get_database_list(void)
19411941

19421942
CommitTransactionCommand();
19431943

1944+
/* Be sure to restore caller's memory context */
1945+
MemoryContextSwitchTo(resultcxt);
1946+
19441947
returndblist;
19451948
}
19461949

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp