pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix temporary memory leak in system table index scans
Date: Tue, 03 Dec 2024 08:14:34 +0000
Message-ID: <E1tIO3F-000sep-PD@gemulon.postgresql.org> (raw)

Fix temporary memory leak in system table index scans

Commit 811af9786b introduced palloc() calls into systable_beginscan()
and systable_beginscan_ordered().  But there was no pfree(), as is the
usual style.

It turns out that an ANALYZE of a partitioned table can invoke many
thousand system table index scans, and this memory is not cleaned up
until the end of the command, so this can temporarily leak quite a bit
of memory.  Maybe there are improvements to be made at a higher level
about this, but for now, insert a couple of corresponding pfree()
calls to fix this particular issue.

Reported-by: Justin Pryzby <pryzby@telsasoft.com>
Discussion: https://www.postgresql.org/message-id/Z0XTfIq5xUtbkiIh@pryzbyj2023

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1acf10549e64c6a52ced570d712fcba1a2f5d1ec

Modified Files
--------------
src/backend/access/index/genam.c | 4 ++++
1 file changed, 4 insertions(+)



Message-ID: <E1tIO3F-000sep-PD@gemulon.postgresql.org>
Permalink:  ../E1tIO3F-000sep-PD@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tIO3F-000sep-PD@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix temporary memory leak in system table index scans
  In-Reply-To: <E1tIO3F-000sep-PD@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