Skip to content

Commit 2c7b4ad

Browse files
committed
Suppress complaints about leaks in function cache loading.
PL/pgSQL and SQL-function parsing leak some stuff into the long-lived function cache context. This isn't really a huge practical problem, since it's not a large amount of data and the cruft will be recovered if we have to re-parse the function. It's not clear that it's worth working any harder than the previous patch did to eliminate these leak complaints, so instead silence them with a suppression rule. This suppression rule also hides the fact that CachedFunction structs are intentionally leaked in some cases because we're unsure if any fn_extra pointers remain. That might be nice to do something about eventually, but it's not clear how. Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us
1 parent 9f18fa9 commit 2c7b4ad

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/tools/valgrind.supp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,24 @@
194194
Memcheck:Addr8
195195
fun:pg_numa_touch_mem_if_required
196196
}
197+
198+
199+
# Memory-leak suppressions
200+
# Note that a suppression rule will silence complaints about memory blocks
201+
# allocated in matching places, but it won't prevent "indirectly lost"
202+
# complaints about blocks that are only reachable via the suppressed blocks.
203+
204+
# Suppress complaints about stuff leaked during function cache loading.
205+
# Both the PL/pgSQL and SQL-function parsing processes generate some cruft
206+
# within the function's cache context, which doesn't seem worth the trouble
207+
# to get rid of. Moreover, there are cases where CachedFunction structs
208+
# are intentionally leaked because we're unsure if any fn_extra pointers
209+
# remain.
210+
{
211+
hide_function_cache_leaks
212+
Memcheck:Leak
213+
match-leak-kinds: definite,possible,indirect
214+
215+
...
216+
fun:cached_function_compile
217+
}

0 commit comments

Comments
 (0)