Re: pg_walinspect memory leaks

2023-02-20 Thread Michael Paquier
On Mon, Feb 20, 2023 at 11:34:03AM -0800, Jeff Davis wrote: > Committed to 16 with the changes to GetXLogSummaryStats() as well. > Committed unmodified version of your 15 backport. Thank you! Thanks for taking care of the FPI code path, Jeff! -- Michael signature.asc Description: PGP signature

Re: pg_walinspect memory leaks

2023-02-20 Thread Jeff Davis
On Mon, 2023-02-20 at 15:17 +0530, Bharath Rupireddy wrote: > Similarly, the loops in GetXLogSummaryStats() too > don't palloc any memory, so no memory leak. Break on palloc in gdb in that loop and you'll see a palloc in CStringGetTextDatum(name). In general, you should expect *GetDatum() to

Re: pg_walinspect memory leaks

2023-02-20 Thread Bharath Rupireddy
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

Re: pg_walinspect memory leaks

2023-02-17 Thread Jeff Davis
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? Also, it seems like we should do the

Re: pg_walinspect memory leaks

2023-02-16 Thread Michael Paquier
On Thu, Feb 16, 2023 at 06:00:00PM +0530, Bharath Rupireddy wrote: > The memory usage goes up with many WAL records in GetWALRecordsInfo(). > The affected functions are pg_get_wal_records_info() and > pg_get_wal_records_info_till_end_of_wal(). I think the best way to fix > this is to use a

Re: pg_walinspect memory leaks

2023-02-16 Thread Bharath Rupireddy
On Tue, Feb 14, 2023 at 4:07 PM Bharath Rupireddy wrote: > > On Tue, Feb 14, 2023 at 6:25 AM Andres Freund 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

Re: pg_walinspect memory leaks

2023-02-14 Thread Bharath Rupireddy
On Tue, Feb 14, 2023 at 6:25 AM Andres Freund 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. > >

Re: pg_walinspect memory leaks

2023-02-13 Thread Andres Freund
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

pg_walinspect memory leaks

2023-02-13 Thread Peter Geoghegan
It looks like pg_walinspect's GetWALRecordsInfo() routine doesn't take sufficient care with memory management. It should avoid memory leaks of the kind that lead to OOMs whenever pg_get_wal_records_info_till_end_of_wal() has to return very many tuples. Right now it isn't that hard to make that