From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Silence resource leaks alerts |
Date: | 2025-04-13 22:57:20 |
Message-ID: | CAEudQAqhHNbUVjYaaAPfeyu=GJLueGZyGb1BUMd3nrQBsbC7sA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Em sex., 11 de abr. de 2025 às 08:27, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
escreveu:
> Thanks Michael, for looking at this.
>
>
> Em sex., 11 de abr. de 2025 às 02:09, Michael Paquier <michael(at)paquier(dot)xyz>
> escreveu:
>
>> On Thu, Apr 10, 2025 at 03:10:02PM -0300, Ranier Vilela wrote:
>> > While it is arguable that this is a false warning, there is a benefit in
>> > moving the initialization of the string buffer, silencing the warnings
>> that
>> > are presented in this case.
>> >
>> > 1. pg_overexplain.c
>> > 2. ruleutils.c
>>
>> These code paths are far from being critical and the two ones in
>> ruleutils.c are older, even if it is a practice that had better be
>> discouraged particularly as initStringInfo() can allocate some memory
>> for nothing. So it could bloat the current memory context if these
>> code paths are repeatedly taken.
>>
> Yeah, it's a bit annoying to do unnecessary work.
> Plus a small gain, by delaying memory allocation until when it is actually
> needed.
>
Attached a new example of moving stringinfo creation, per Coverity.
best regards,
Ranier Vilela
Attachment | Content-Type | Size |
---|---|---|
postpone_string_buffer_creation_dblink.patch | application/octet-stream | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2025-04-13 23:01:36 | Re: Logical Replication of sequences |
Previous Message | Noah Misch | 2025-04-13 20:37:58 | Re: datfrozenxid > relfrozenxid w/ crash before XLOG_HEAP_INPLACE |