Re: pg_walinspect memory leaks

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_walinspect memory leaks
Date: 2023-02-14 10:37:42
Message-ID: CALj2ACXsjZ9QpG1Y9L4igHYGYU30TogKdqxAN4JAexk-dbxBNg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 14, 2023 at 6:25 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> Hi,
>
> On 2023-02-13 15:22:02 -0800, Peter Geoghegan wrote:
> > More concretely, it looks like GetWALRecordInfo() calls
> > CStringGetTextDatum/cstring_to_text in a way that accumulates way too
> > much memory in ExprContext.
>
> Additionally, we leak two stringinfos for each record.
>
>
> > This could be avoided by using a separate memory context that is reset
> > periodically, or something else along the same lines.
>
> Everything other than a per-row memory context that's reset each time seems
> hard to manage in this case.
>
> Somehwat funnily, GetWALRecordsInfo() then ends up being unnecessarily
> dilligent about cleaning up O(1) memory, after not caring about O(N) memory...

Thanks for reporting. I'll get back to you on this soon.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2023-02-14 10:45:53 Re: Todo: Teach planner to evaluate multiple windows in the optimal order
Previous Message houzj.fnst@fujitsu.com 2023-02-14 10:28:23 RE: Support logical replication of DDLs