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

Commit1acf105

Browse files
committed
Fix temporary memory leak in system table index scans
Commit811af97 introduced palloc() calls into systable_beginscan()and systable_beginscan_ordered(). But there was no pfree(), as is theusual style.It turns out that an ANALYZE of a partitioned table can invoke manythousand system table index scans, and this memory is not cleaned upuntil the end of the command, so this can temporarily leak quite a bitof memory. Maybe there are improvements to be made at a higher levelabout this, but for now, insert a couple of corresponding pfree()calls to fix this particular issue.Reported-by: Justin Pryzby <pryzby@telsasoft.com>Discussion:https://www.postgresql.org/message-id/Z0XTfIq5xUtbkiIh@pryzbyj2023
1 parent1ba0782 commit1acf105

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎src/backend/access/index/genam.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,8 @@ systable_beginscan(Relation heapRelation,
449449
snapshot,nkeys,0);
450450
index_rescan(sysscan->iscan,idxkey,nkeys,NULL,0);
451451
sysscan->scan=NULL;
452+
453+
pfree(idxkey);
452454
}
453455
else
454456
{
@@ -713,6 +715,8 @@ systable_beginscan_ordered(Relation heapRelation,
713715
index_rescan(sysscan->iscan,idxkey,nkeys,NULL,0);
714716
sysscan->scan=NULL;
715717

718+
pfree(idxkey);
719+
716720
/*
717721
* If CheckXidAlive is set then set a flag to indicate that system table
718722
* scan is in-progress. See detailed comments in xact.c where these

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp