Skip to content

Commit b0be247

Browse files
committed
Fix a tiny memory leak (one List header) in RelationCacheInvalidate().
This is utterly insignificant in normal operation, but it becomes a problem during cache inval stress testing. The original coding in fact had no leak --- the 8.0 List rewrite created the issue. I wonder whether list_concat should pfree the discarded header?
1 parent 7259cc1 commit b0be247

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/backend/utils/cache/relcache.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.235 2006/01/08 20:04:41 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.236 2006/01/19 00:27:08 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1795,8 +1795,6 @@ RelationCacheInvalidate(void)
17951795
}
17961796
}
17971797

1798-
rebuildList = list_concat(rebuildFirstList, rebuildList);
1799-
18001798
/*
18011799
* Now zap any remaining smgr cache entries. This must happen before we
18021800
* start to rebuild entries, since that may involve catalog fetches which
@@ -1805,6 +1803,12 @@ RelationCacheInvalidate(void)
18051803
smgrcloseall();
18061804

18071805
/* Phase 2: rebuild the items found to need rebuild in phase 1 */
1806+
foreach(l, rebuildFirstList)
1807+
{
1808+
relation = (Relation) lfirst(l);
1809+
RelationClearRelation(relation, true);
1810+
}
1811+
list_free(rebuildFirstList);
18081812
foreach(l, rebuildList)
18091813
{
18101814
relation = (Relation) lfirst(l);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy