Tynan Couture-Rashid <tynan(at)awardedsoftware(dot)com> writes:
> I tracked down a per-call memory leak in
> InitMaterializedSRF(). It shows up via jsonb_each() and similar
> set-returning functions. We had a bad query in production and the plan
> called jsonb_each() about 87 million times, exacerbating this leak and
> causing the server to run out of memory.
Thanks for the report and the patches. Questions:
1. Do we actually need both patches? It seems like 0002 alone might
solve the problem more efficiently.
2. Why does 0001 propose using CreateTupleDescCopyConstr?
The adjacent call is just CreateTupleDescCopy, so this looks
inconsistent. I do not think the result of get_call_result_type
would ever carry constraints, though I admit I didn't dig.
regards, tom lane