Re: Memory leak in CachememoryContext - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Memory leak in CachememoryContext
Date
Msg-id 20230424160419.44voc3w5r72uigb6@alvherre.pgsql
Whole thread Raw
In response to Re: Memory leak in CachememoryContext  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Memory leak in CachememoryContext
List pgsql-hackers
On 2023-Apr-24, Tom Lane wrote:

> I wrote:
> > Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> >> Hmm, we can leave it unused in our code, but it still needs to be
> >> initialized to some valid memory context anyway; otherwise hypothetical
> >> code that uses it would still crash.
> 
> > I think we want that to happen, actually, because it's impossible
> > to guess what such hypothetical code needs the context to be.
> 
> I guess we could have the back branches continue to create a
> shared_cast_context and just not use it in core.  Seems rather
> expensive for a very hypothetical compatibility measure, though.

I think a session-long memory leak is not so bad, compared to a possible
crash.  However, after looking at the code again, as well as pldebugger
and plpgsql_check, I agree that there's no point in doing anything other
than keeping the field there.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Hay dos momentos en la vida de un hombre en los que no debería
especular: cuando puede permitírselo y cuando no puede" (Mark Twain)



pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: could not extend file "base/5/3501" with FileFallocate(): Interrupted system call
Next
From: Robert Haas
Date:
Subject: Re: Should we remove vacuum_defer_cleanup_age?