pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Limit memory usage of pg_walinspect functions.
Date: Mon, 20 Feb 2023 19:29:05 +0000
Message-ID: <E1pUBqS-0028Cn-PG@gemulon.postgresql.org> (raw)

Limit memory usage of pg_walinspect functions.

GetWALRecordsInfo() and pg_get_wal_fpi_info() can leak memory across
WAL record iterations. Fix this by using a temporary memory context
that's reset for each WAL record iteraion.

Also a use temporary context for loops in GetXLogSummaryStats(). The
number of iterations is a small constant, so the previous behavior was
not a leak, but fix for clarity (but no need to backport).

Backport GetWALRecordsInfo() change to version
15. pg_get_wal_fpi_info() didn't exist in version 15.

Reported-by: Peter Geoghegan
Author: Bharath Rupireddy
Discussion: https://www.postgresql.org/message-id/CAH2-WznLEJjn7ghmKOABOEZYuJvkTk%3DGKU3m0%2B-XBAH%2BerPiJQ%40ma...
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/69e8c7cf1dfa08ae099c33d0d371ad69d405903d

Modified Files
--------------
contrib/pg_walinspect/pg_walinspect.c | 58 ++++++++++++++++++++++++++++++++---
1 file changed, 53 insertions(+), 5 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1pUBqS-0028Cn-PG@gemulon.postgresql.org>
Permalink:  ../E1pUBqS-0028Cn-PG@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pUBqS-0028Cn-PG@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: jdavis@postgresql.org
  Subject: Re: pgsql: Limit memory usage of pg_walinspect functions.
  In-Reply-To: <E1pUBqS-0028Cn-PG@gemulon.postgresql.org>
  References: <E1pUBqS-0028Cn-PG@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox