public inbox for [email protected]
help / color / mirror / Atom feedFrom: David Rowley <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: BUG #19438: segfault with temp_file_limit inside cursor
Date: Mon, 30 Mar 2026 12:33:57 +1300
Message-ID: <CAApHDvreSetP_7y8bPbNxEYtWuyVrwUpgePa7=w8W1WfyjcEyQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<CAApHDvox3Ro8mZJxignuyB-dGXJ9=wQNEkOFni9025GP=rOKkg@mail.gmail.com>
<[email protected]>
<[email protected]>
On Mon, 30 Mar 2026 at 05:25, Tom Lane <[email protected]> wrote:
> I started to wonder if an explicit test in AlignedAllocFree
> could be useful anyway to make such problems a bit less obscure.
> However, when I tried
>
> p = palloc_aligned(...);
> pfree(p);
> pfree(p);
>
> I got
>
> ERROR: pfree called with invalid pointer 0x1f286b0 (header 0x7f7f7f7f7f7f7f7f)
>
> That is, we'll never get to AlignedAllocFree because the underlying
> context would have wipe_mem'd the aligned chunk's header during the
> first pfree. The only case in which such a test could be helpful is
> in a build with MEMORY_CONTEXT_CHECKING but not CLOBBER_FREED_MEMORY.
> While I suppose some people might build that way, it's got to be such
> a tiny minority as to not be worth worrying about.
I think you might have trouble trying to get the MemoryContext.name
for the elog warning anyway. That's only accessible from the unaligned
allocation and whatever method that context type uses to backlink the
owning context from the chunk pointer. Given that, it very much seems
not worthwhile as I imagine that means adding some callback function
to MemoryContextMethods!
David
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]
Subject: Re: BUG #19438: segfault with temp_file_limit inside cursor
In-Reply-To: <CAApHDvreSetP_7y8bPbNxEYtWuyVrwUpgePa7=w8W1WfyjcEyQ@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