Re: plpgsql memory leaks

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Michael Banck <mbanck(at)gmx(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plpgsql memory leaks
Date: 2024-01-12 19:09:14
Message-ID: CAFj8pRCMjozEaBxuLRXB50CYkPoui4WtbX6XaRKvOYPp+76Zcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pá 12. 1. 2024 v 14:53 odesílatel Michael Banck <mbanck(at)gmx(dot)net> napsal:

> Hi,
>
> On Fri, Jan 12, 2024 at 01:35:24PM +0100, Pavel Stehule wrote:
> > pá 12. 1. 2024 v 11:54 odesílatel Michael Banck <mbanck(at)gmx(dot)net> napsal:
> > > Which version of Postgres is this and on which platform/distribution?
> >
> > It was tested on master branch (pg 17) on Fedora 39
> >
> > > Did you try keep jit on but set jit_inline_above_cost to 0?
> > >
> > > The back-branches have a fix for the above case, i.e. llvmjit memleaks
> > > that can be worked-around by setting jit_inline_above_cost=0.
>
> I got that wrong, it needs to be -1 to disable it.
>
> But if you are already running the master branch, it is probably a
> separate issue.
>

I tested code

CREATE OR REPLACE FUNCTION public.fx(iter integer)
RETURNS void
LANGUAGE plpgsql
AS $function$
declare
c cursor(m bigint) for select distinct i from generate_series(1, m) g(i);
t bigint;
s bigint;
begin
for i in 1..iter
loop
s := 0;
for r in c(i*10000)
loop
s := s + r.i;
end loop;
raise notice '%=%', i, s;
end loop;
end;
$function$

default master branch - res 190MB ram
jit_inline_above_cost = -1 doesn't helps
disabling JIT doesn't helps too,

so it looks like the wrong hypothesis , and the problem is maybe somewhere
else :-/

Regards

Pavel

>
>
> Michael
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2024-01-12 19:09:23 Re: Confine vacuum skip logic to lazy_scan_skip
Previous Message Jim Nasby 2024-01-12 19:02:33 Re: Confine vacuum skip logic to lazy_scan_skip