Re: terminate called after throwing an instance of 'std::bad_alloc'

From: Andres Freund <andres(at)anarazel(dot)de>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: terminate called after throwing an instance of 'std::bad_alloc'
Date: 2021-04-21 00:20:56
Message-ID: 20210421002056.gjd6rpe6toumiqd6@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2021-04-20 00:58:21 -0500, Justin Pryzby wrote:
> On Tue, Apr 20, 2021 at 12:38:26AM -0500, Justin Pryzby wrote:
> > I don't know if this is related to the other issues, but this seems leaky.
>
> And it explains how the context use counter can exceed its threshold.
>
> create or replace function fn() returns void language plpgsql as $$ declare rec int; begin SELECT relpages INTO rec FROM pg_class LIMIT 1; end $$;
> explain analyze
> SELECT fn()
> FROM generate_series(1,99);
>
> SELECT SUM(a) FROM (VALUES(1))a(a);
>
> time PGOPTIONS='-cclient_min_messages=debug -clog_executor_stats=off -clog_min_duration_statement=-1 -cjit=on -cjit_above_cost=0 -cjit_inline_above_cost=0' psql ts -f jitleak.sql
> ...
> psql:jitleak.sql:6: DEBUG: recreating LLVM context after 100 uses

Right - at the moment the context can only be recreated when there's no
JITed queries ongoing. That's why I asked whether your "real" query
contains function calls, and whether those functions are expensive
enough to be JITed.

> Question: does the jit context need to be recreated only when inlining is
> enabled? Or maybe it's better if it's not conditionalized like that..

It'd be sufficient to do it when doing inlining, but currently that's
not tracked separately.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-04-21 00:30:56 Re: Privilege boundary between sysadmin and database superuser [Was: Re: pg_amcheck option to install extension]
Previous Message Junfeng Yang 2021-04-21 00:19:11 回复: Partitioned table permission question