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

From Tom Lane
Subject Re: Memory leak in CachememoryContext
Date
Msg-id 183629.1682345485@sss.pgh.pa.us
Whole thread Raw
In response to Re: Memory leak in CachememoryContext  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: Memory leak in CachememoryContext  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
>> (Note to self: we can't remove the cast_hash_context field in
>> back branches for fear of causing an ABI break for pldebugger.
>> But we can leave it unused, I think.)

> 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.
As things stand now, that field points to a long-lived context
in some cases and a short-lived one in others.  We risk either
data structure corruption or a session-lifespan memory leak
if we guess about such usage ... which really shouldn't exist
anyway.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: run pgindent on a regular basis / scripted manner
Next
From: Tom Lane
Date:
Subject: Re: run pgindent on a regular basis / scripted manner