Re: Fix memory leak in tzparser.c - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Fix memory leak in tzparser.c
Date
Msg-id CAExHW5vLFD+uzwt3vGu1dSP3CZH=vGpHWxaedtk_VYr2gpCVeg@mail.gmail.com
Whole thread Raw
In response to Re: Fix memory leak in tzparser.c  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Fix memory leak in tzparser.c
List pgsql-hackers
On Tue, Dec 16, 2025 at 1:29 PM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Tue, Dec 16, 2025 at 05:55:32AM +0000, Shixin Wang wrote:
> > While the memory is managed by a temp memory context that gets cleaned up
> > eventually, the coarse-grained management might cause some memory to
> > accumulate during ParseTzFile() recursive calls when processing @INCLUDE
> > directives.
> >
> > I've attached a patch with this change in case anyone thinks it's worth
> > applying.
>
> Why does it matter?  load_tzoffsets() is the sole caller of
> ParseTzFile() and it uses a temporary memory context named
> TZParserMemory to not have to do cleanups like the one you are
> proposing here.

+1. But maybe Shixin has seen a scenario where this temporary
accumulation has caused some problems because say there were many
entries whose zone was replaced? Shixin, what problem did you see
which prompted you to create this patch?

--
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: Zsolt Parragi
Date:
Subject: Re: Make PGOAUTHCAFILE in libpq-oauth work out of debug mode
Next
From: jian he
Date:
Subject: Re: CREATE SCHEMA ... CREATE DOMAIN support