aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-01-19 00:27:08 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-01-19 00:27:08 +0000
commitb0be247e38bdeb3911e70f5844bcbb48a1055917 (patch)
tree573a238af4cb8aa6c41b55359e98525eba75ede5
parent7259cc1e7eaa3e21a013902b0a70b9eb15c6b29f (diff)
downloadpostgresql-b0be247e38bdeb3911e70f5844bcbb48a1055917.tar.gz
postgresql-b0be247e38bdeb3911e70f5844bcbb48a1055917.zip
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?
-rw-r--r--src/backend/utils/cache/relcache.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 9d4e402ae20..bccea5fa173 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.235 2006/01/08 20:04:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.236 2006/01/19 00:27:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1795,8 +1795,6 @@ RelationCacheInvalidate(void)
}
}
- rebuildList = list_concat(rebuildFirstList, rebuildList);
-
/*
* Now zap any remaining smgr cache entries. This must happen before we
* start to rebuild entries, since that may involve catalog fetches which
@@ -1805,6 +1803,12 @@ RelationCacheInvalidate(void)
smgrcloseall();
/* Phase 2: rebuild the items found to need rebuild in phase 1 */
+ foreach(l, rebuildFirstList)
+ {
+ relation = (Relation) lfirst(l);
+ RelationClearRelation(relation, true);
+ }
+ list_free(rebuildFirstList);
foreach(l, rebuildList)
{
relation = (Relation) lfirst(l);