Re: Memory leak in CachememoryContext

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ajit Awekar <ajit(dot)awekar(at)enterprisedb(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Rushabh Lathia <rushabh(dot)lathia(at)enterprisedb(dot)com>, Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
Subject: Re: Memory leak in CachememoryContext
Date: 2023-04-24 16:04:19
Message-ID: 20230424160419.44voc3w5r72uigb6@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2023-Apr-24, Tom Lane wrote:

> I wrote:
> > Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)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)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2023-04-24 16:09:45 Re: Should we remove vacuum_defer_cleanup_age?
Previous Message Melanie Plageman 2023-04-24 15:58:55 Re: could not extend file "base/5/3501" with FileFallocate(): Interrupted system call