Don't leak rd_statlist when a relcache entry is dropped.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 19 Mar 2021 00:37:09 +0000 (20:37 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 19 Mar 2021 02:22:47 +0000 (22:22 -0400)
commit28644fac10731e30e70b622986a6fbbeb5a5b2f9
treef2cb8f70089b1ea9b1f84650ab928d783e4a50dc
parenta16b2b960f0eec2fe367e86017b3c24ed688ba2b
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
src/backend/utils/cache/relcache.c