Commit 28644fac authored by Tom Lane's avatar Tom Lane

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
parent a16b2b96
...@@ -2392,6 +2392,7 @@ RelationDestroyRelation(Relation relation, bool remember_tupdesc) ...@@ -2392,6 +2392,7 @@ RelationDestroyRelation(Relation relation, bool remember_tupdesc)
FreeTriggerDesc(relation->trigdesc); FreeTriggerDesc(relation->trigdesc);
list_free_deep(relation->rd_fkeylist); list_free_deep(relation->rd_fkeylist);
list_free(relation->rd_indexlist); list_free(relation->rd_indexlist);
list_free(relation->rd_statlist);
bms_free(relation->rd_indexattr); bms_free(relation->rd_indexattr);
bms_free(relation->rd_keyattr); bms_free(relation->rd_keyattr);
bms_free(relation->rd_pkattr); bms_free(relation->rd_pkattr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment