public inbox for [email protected]help / color / mirror / Atom feed
[PATCH] Silence a new Valgrind warning 3+ messages / 2 participants [nested] [flat]
* [PATCH] Silence a new Valgrind warning @ 2026-03-12 12:56 Aleksander Alekseev <[email protected]> 0 siblings, 2 replies; 3+ messages in thread From: Aleksander Alekseev @ 2026-03-12 12:56 UTC (permalink / raw) To: pgsql-hackers Hi, Commit 4966bd3ed95e revealed a non-critical memory leak in ProcessStartupPacket() which Valgrind is very much upset about: ``` 63 (32 direct, 31 indirect) bytes in 1 blocks are definitely lost in loss record 355 of 800 at 0x9D260C: palloc (mcxt.c:1411) by 0x54B3D2: new_list (list.c:137) by 0x54B8CC: lappend (list.c:344) by 0x78B41A: ProcessStartupPacket (backend_startup.c:786) by 0x78A411: BackendInitialize (backend_startup.c:295) by 0x789F2F: BackendMain (backend_startup.c:110) by 0x67EEED: postmaster_child_launch (launch_backend.c:268) by 0x685D50: BackendStartup (postmaster.c:3606) by 0x6830CF: ServerLoop (postmaster.c:1713) by 0x682982: PostmasterMain (postmaster.c:1403) by 0x547DFE: main (main.c:231) ``` The proposed patch silences the warnings. -- Best regards, Aleksander Alekseev Attachments: [text/x-patch] v1-0001-Free-memory-allocated-for-unrecognized_protocol_o.patch (1.2K, 2-v1-0001-Free-memory-allocated-for-unrecognized_protocol_o.patch) download | inline diff: From 079a646f4db6ff80ec02a6bb8884f4c5b075345c Mon Sep 17 00:00:00 2001 From: Aleksander Alekseev <[email protected]> Date: Thu, 12 Mar 2026 14:53:38 +0300 Subject: [PATCH v1] Free memory allocated for unrecognized_protocol_options Since 4966bd3ed95e Valgrind started to warn about little amount of memory being leaked in ProcessStartupPacket(). This is not critical but the warnings may distract from real issues. Fix it by freeing the list after use. Author: Aleksander Alekseev <[email protected]> Reviewed-by: TODO FIXME Discussion: TODO FIXME --- src/backend/tcop/backend_startup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/tcop/backend_startup.c b/src/backend/tcop/backend_startup.c index c517115927c..5abf276c898 100644 --- a/src/backend/tcop/backend_startup.c +++ b/src/backend/tcop/backend_startup.c @@ -825,6 +825,8 @@ ProcessStartupPacket(Port *port, bool ssl_done, bool gss_done) if (PG_PROTOCOL_MINOR(proto) > PG_PROTOCOL_MINOR(PG_PROTOCOL_LATEST) || unrecognized_protocol_options != NIL) SendNegotiateProtocolVersion(unrecognized_protocol_options); + + list_free_deep(unrecognized_protocol_options); } /* Check a user name was given. */ -- 2.43.0 ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [PATCH] Silence a new Valgrind warning @ 2026-03-13 17:30 Aleksander Alekseev <[email protected]> parent: Aleksander Alekseev <[email protected]> 1 sibling, 0 replies; 3+ messages in thread From: Aleksander Alekseev @ 2026-03-13 17:30 UTC (permalink / raw) To: pgsql-hackers; +Cc: Heikki Linnakangas <[email protected]> Hi Heikki, > I don't see that warning. What valgrind options did you use? > > The patch looks good to me. Here is the script I'm using: https://github.com/afiskon/pgscripts/blob/master/valgrind-meson.sh -- Best regards, Aleksander Alekseev ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [PATCH] Silence a new Valgrind warning @ 2026-03-13 17:33 Peter Geoghegan <[email protected]> parent: Aleksander Alekseev <[email protected]> 1 sibling, 0 replies; 3+ messages in thread From: Peter Geoghegan @ 2026-03-13 17:33 UTC (permalink / raw) To: Heikki Linnakangas <[email protected]>; +Cc: Aleksander Alekseev <[email protected]>; pgsql-hackers On Fri, Mar 13, 2026 at 11:33 AM Heikki Linnakangas <[email protected]> wrote: > > The proposed patch silences the warnings. > > I don't see that warning. What valgrind options did you use? I have seen this one, though only when --leak-check=yes is passed to Valgrind. -- Peter Geoghegan ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-03-13 17:33 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-03-12 12:56 [PATCH] Silence a new Valgrind warning Aleksander Alekseev <[email protected]> 2026-03-13 17:30 ` Aleksander Alekseev <[email protected]> 2026-03-13 17:33 ` Peter Geoghegan <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox