Re: Memory leak on subquery as scalar operand

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, lauri(dot)laanmets(at)eesti(dot)ee, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Memory leak on subquery as scalar operand
Date: 2022-11-01 04:52:16
Message-ID: 1084048.1667278336@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

David Rowley <dgrowleyml(at)gmail(dot)com> writes:
> The single subquery version also crashes for me, so perhaps it's just
> the amount of memory that's being used and when the OOM killer is
> triggering.
> It crashes even when I set jit_inline_above_cost and
> jit_optimize_above_cost above the query's cost.

Hmm, maybe we're not seeing the same thing? For me, the behavior
seems similar to what the OP reported: there's a per-query leakage
but it's less than 100kB per query. It'd take more than a handful
of repetitions to get to an OOM failure. This is with LLVM 13.0.1
on RHEL 8.6.

Also, as far as I can see there is no leak with the single-subquery
version. The process's reported VIRT consumption bounces around a
fair amount, but it doesn't go above 300MB, even after ~10min in
a tight plpgsql DO loop. VIRT bounces around a lot with the
two-subquery version too, actually, but there does seem to be a
general uptrend there. I did not have the patience to wait for
actual OOM; it looked like it'd take a good long while, tens
of minutes at least.

If the behavior varies across LLVM versions, as is now seeming
a bit likely, it might be their bug not ours.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2022-11-01 05:51:32 Re: Memory leak on subquery as scalar operand
Previous Message David Rowley 2022-11-01 04:26:16 Re: Memory leak on subquery as scalar operand