public inbox for [email protected]
help / color / mirror / Atom feedFrom: David Rowley <[email protected]>
To: Bertrand Drouvot <[email protected]>
Cc: [email protected]
Subject: Re: Use stack allocated StringInfoDatas, where possible (round 2)
Date: Mon, 13 Apr 2026 01:34:52 +1200
Message-ID: <CAApHDvqFBWx+Ghdy3_LXq5u+v-HCS0zwh4Pp+qtaSfJxmMhkiA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
On Sun, 12 Apr 2026 at 22:49, Bertrand Drouvot
<[email protected]> wrote:
> Indeed, 5509055d6956 added a few cases that are using StringInfo but don't need
> that StringInfo to exist beyond the scope of the function were using makeStringInfo(),
> which allocates both a StringInfoData and the buffer it uses as two separate
> allocations. It's more efficient for these cases to use a StringInfoData on the
> stack and initialize it with initStringInfo(), which only allocates the string
> buffer.
I think the author of copy_sequences() doesn't know what
resetStringInfo() does. I expect they think that it'll pfree all the
memory, but that's what destroyStringInfo() is for.
Since the strings are not used after the resetStringInfo(), the call
is pointless. Could you ask Amit K to fix that first? Then rebase your
patch atop.
I think it makes sense to apply your patch as a StringInfo fixup
post-freeze for v19 as leaving this for v20 will just result in the
code not matching for no particularly good reason.
David
view thread (4+ 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]
Subject: Re: Use stack allocated StringInfoDatas, where possible (round 2)
In-Reply-To: <CAApHDvqFBWx+Ghdy3_LXq5u+v-HCS0zwh4Pp+qtaSfJxmMhkiA@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