What version of postgres ?
I wonder if you're hitting the known memory leak involving jit.Try with jit=off or jit_inline_above_cost=-1.
-- Justin