Re: pg_walinspect memory leaks
От
Bharath Rupireddy
Тема
Re: pg_walinspect memory leaks
Дата
Msg-id
CALj2ACWk37AGHCY_8K-=d57PtkF0TJcDS-ccZRM5NHAx2a7P0Q@mail.gmail.com
Ответ на
Re: pg_walinspect memory leaks (Jeff Davis)
Список
Дерево обсуждения
pg_walinspect memory leaks Peter Geoghegan <pg@bowt.ie>
Re: pg_walinspect memory leaks Andres Freund <andres@anarazel.de>
Re: pg_walinspect memory leaks Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: pg_walinspect memory leaks Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: pg_walinspect memory leaks Jeff Davis <pgsql@j-davis.com>
Re: pg_walinspect memory leaks Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Re: pg_walinspect memory leaks Jeff Davis <pgsql@j-davis.com>
Re: pg_walinspect memory leaks Michael Paquier <michael@paquier.xyz>
Re: pg_walinspect memory leaks Michael Paquier <michael@paquier.xyz>
On Sat, Feb 18, 2023 at 5:07 AM Jeff Davis 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
В списке pgsql-hackers по дате отправления