public inbox for [email protected]  
help / color / mirror / Atom feed
From: Amit Kapila <[email protected]>
To: Xuneng Zhou <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: [email protected] <[email protected]>
Cc: Zhijie Hou (Fujitsu) <[email protected]>
Subject: Re: Bound memory usage during manual slot sync retries
Date: Tue, 26 May 2026 16:39:34 -0700
Message-ID: <CAA4eK1+mGigBhtZG3ZNZim0EDDcrEjauCTNp7S1166xesSRnFQ@mail.gmail.com> (raw)
In-Reply-To: <CABPTF7XCcMq=AeCY-E67VRwo=ap53bfmKngr289PirAo4XuUXA@mail.gmail.com>
References: <CABPTF7VVPxgfYyr8Kyi=+JACjckQ6NpniV9eRtHboj2hMn0REw@mail.gmail.com>
	<CAA4eK1+4KCedvh1AWuWf_A9AvS79Jdt8Mu-22ofKV143gEu8Ow@mail.gmail.com>
	<CABPTF7X5mn8qupFxTfDL0SSzEzepRM4ou3rm7Lw=Z=nX3PEDgg@mail.gmail.com>
	<CABPTF7VRRfkyTEBuzdvN=Tniki6ugXo6Wy3Ejx6xUAF1-F9ACA@mail.gmail.com>
	<CAA4eK1Kc_wF_sN=fjBAOPqbTonM71bd+aM0CfHg9D7oObogCEQ@mail.gmail.com>
	<CAA4eK1L=P+4hdnic8gQ1QFL9KZiM_mReCNTYWx99ct23mCoZ8g@mail.gmail.com>
	<CABPTF7XCcMq=AeCY-E67VRwo=ap53bfmKngr289PirAo4XuUXA@mail.gmail.com>

On Tue, May 26, 2026 at 1:01 PM Xuneng Zhou <[email protected]> wrote:
>
>
>> On Mon, May 25, 2026 at 7:03 PM Amit Kapila <[email protected]> wrote:
>> >
>> > Okay, then let's go with a per-retry memory context approach.
>> >
>> > @@ -579,6 +579,8 @@ drop_local_obsolete_slots(List *remote_slot_list)
>> >      local_slot->data.database));
>> >   }
>> >   }
>> > +
>> > + list_free(local_slots);
>> >  }
>> >
>> > Why do we need this retail pfree if the caller is using memory context?
>> >
>>
>> I see that the latest patch in email [1] has already addressed this
>> point. So, I'll push the v2 version.
>>
>> [1] - https://www.postgresql.org/message-id/CABPTF7WB4Z62sPoZkhSygOCAo3OiTDLpMELxZDuwCb3HYgM_pQ%40mail.gma...
>
>
> Thanks. My original reasoning for adding the pfree here was to act as a safety guard in case other future callers might not manage the memory properly. But Zhijie pointed out that this double-free pattern is not favored in previous community discussions. I'll post the  worst-case test and its results later.
>

Pushed.

-- 
With Regards,
Amit Kapila.






view thread (9+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Bound memory usage during manual slot sync retries
  In-Reply-To: <CAA4eK1+mGigBhtZG3ZNZim0EDDcrEjauCTNp7S1166xesSRnFQ@mail.gmail.com>

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

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