Re: [PATCH v1] fix potential memory leak in untransformRelOptions

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Junwang Zhao <zhjwpku(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH v1] fix potential memory leak in untransformRelOptions
Date: 2022-09-01 12:14:52
Message-ID: 5B427D2A-F0C4-4C18-AA70-329DDA576F2A@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 1 Sep 2022, at 10:36, Junwang Zhao <zhjwpku(at)gmail(dot)com> wrote:

> *TextDatumGetCString* calls palloc to alloc memory for the option
> text datum, in some cases the the memory is allocated in
> *TopTransactionContext*, this may cause memory leak for a long
> running backend.

Wouldn't that be a fairly small/contained leak in comparison to memory spent
during a long running transaction? Do you have any example of transforming
reloptions in a loop into TopTransactionContext where it might add up?

--
Daniel Gustafsson https://vmware.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2022-09-01 12:18:00 Re: Tracking last scan time
Previous Message Bharath Rupireddy 2022-09-01 12:11:44 Proposal: Allow walsenders to send WAL directly from wal_buffers to replicas