From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Jeff Davis <pgsql(at)j-davis(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: pg_walinspect memory leaks |
Date: | 2023-02-20 09:47:00 |
Message-ID: | CALj2ACWk37AGHCY_8K-=d57PtkF0TJcDS-ccZRM5NHAx2a7P0Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Feb 18, 2023 at 5:07 AM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
>
> On Thu, 2023-02-16 at 18:00 +0530, Bharath Rupireddy wrote:
> > I'm attaching the patches here. For HEAD, I'd
> > want to be a bit defensive and use the temporary memory context for
> > pg_get_wal_fpi_info() too.
>
> I don't see why we shouldn't backpatch that, too?
pg_get_wal_fpi_info() is added in v16, so backpatching isn't necessary.
> Also, it seems like we should do the same thing for the loop in
> GetXLogSummaryStats(). Maybe just for the outer loop is fine (the inner
> loop is only 16 elements); though again, there's not an obvious
> downside to fixing that, too.
Firstly, WAL record traversing loop in GetWalStats() really doesn't
leak memory, because it just increments some counters and doesn't
palloc any memory. Similarly, the loops in GetXLogSummaryStats() too
don't palloc any memory, so no memory leak. I've seen no memory growth
during execution of pg_get_wal_stats_till_end_of_wal() for 35million
WAL records, see [1] PID 543967 (during the execution of the stats
function, the memory usage remained constant). Therefore, I feel that
the fix isn't required for GetWalStats().
[1]
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
543967 ubuntu 20 0 168668 152056 149988 R 99.7 0.5 1:33.72
postgres
412271 ubuntu 20 0 1101852 252724 42904 S 1.3 0.8 2:18.36
node
412208 ubuntu 20 0 965000 112488 36012 S 0.3 0.4 0:23.46
node
477193 ubuntu 20 0 5837096 34172 9420 S 0.3 0.1 0:00.93
cpptools-srv
--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
From | Date | Subject | |
---|---|---|---|
Next Message | e.indrupskaya | 2023-02-20 09:47:54 | Re: SQL/JSON revisited |
Previous Message | Peter Eisentraut | 2023-02-20 09:00:26 | Re: Allow tailoring of ICU locales with custom rules |