diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-03-18 20:37:09 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-03-18 20:37:09 -0400 |
commit | 5368369701447b4f2a767c34cfde1f9f4eb53f7a (patch) | |
tree | aa2e913d40ebe5d121626fc824501f2950dda1d8 | |
parent | 0c3079e3ef6956feefc9cc4f62ad1f9acc7c84e9 (diff) | |
download | postgresql-5368369701447b4f2a767c34cfde1f9f4eb53f7a.tar.gz postgresql-5368369701447b4f2a767c34cfde1f9f4eb53f7a.zip |
Don't leak rd_statlist when a relcache entry is dropped.
Although these lists are usually NIL, and even when not empty
are unlikely to be large, constant relcache update traffic could
eventually result in visible bloat of CacheMemoryContext.
Found via valgrind testing.
Back-patch to v10 where this field was added.
Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us
-rw-r--r-- | src/backend/utils/cache/relcache.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 9c9cb6377a5..467d3ce3aa6 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -2378,6 +2378,7 @@ RelationDestroyRelation(Relation relation, bool remember_tupdesc) FreeTriggerDesc(relation->trigdesc); list_free_deep(relation->rd_fkeylist); list_free(relation->rd_indexlist); + list_free(relation->rd_statlist); bms_free(relation->rd_indexattr); bms_free(relation->rd_keyattr); bms_free(relation->rd_pkattr); |