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

Commit70a6c37

Browse files
author
Amit Kapila
committed
Fix memory leak introduced in commit7df159a.
We memorize all internal and empty leaf pages in the 1st vacuum stage forgist indexes. They are used in the 2nd stage, to delete all the emptypages. There was a memory context page_set_context for this purpose, butwe never used it.Reported-by: Amit KapilaAuthor: Dilip KumarReviewed-by: Amit KapilaBackpatch-through: 12, where it got introducedDiscussion:https://postgr.es/m/CAA4eK1LGr+MN0xHZpJ2dfS8QNQ1a_aROKowZB+MPNep8FVtwAA@mail.gmail.com
1 parentba19a6b commit70a6c37

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/backend/access/gist/gistvacuum.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ gistvacuumscan(IndexVacuumInfo *info, GistBulkDeleteResult *stats,
169169
BlockNumbernum_pages;
170170
boolneedLock;
171171
BlockNumberblkno;
172+
MemoryContextoldctx;
172173

173174
/*
174175
* Reset counts that will be incremented during the scan; needed in case
@@ -179,8 +180,17 @@ gistvacuumscan(IndexVacuumInfo *info, GistBulkDeleteResult *stats,
179180
stats->stats.pages_deleted=0;
180181
stats->stats.pages_free=0;
181182
MemoryContextReset(stats->page_set_context);
183+
184+
/*
185+
* Create the integer sets to remember all the internal and the empty leaf
186+
* pages in page_set_context. Internally, the integer set will remember
187+
* this context so that the subsequent allocations for these integer sets
188+
* will be done from the same context.
189+
*/
190+
oldctx=MemoryContextSwitchTo(stats->page_set_context);
182191
stats->internal_page_set=intset_create();
183192
stats->empty_leaf_set=intset_create();
193+
MemoryContextSwitchTo(oldctx);
184194

185195
/* Set up info to pass down to gistvacuumpage */
186196
vstate.info=info;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp