Re: Why our Valgrind reports suck

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Why our Valgrind reports suck
Date: 2025-05-21 17:14:41
Message-ID: 1295385.1747847681@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here's a v2 patchset that reaches the goal of zero reported leaks
in the core regression tests, with some caveats:

* Rather than completely fixing the function-cache and
TS-dictionary-cache issues, I just added suppression rules to
hide them. I am not convinced it is worth working harder than that.
The patchset does include some fixes that clean up low-hanging fruit
in that area, but going further seems like a lot of work (and risk of
bugs) for fairly minimal gain. The core regression tests show less
than 10K "suppressed" space in all test sessions but three, and those
three are still under 100K.

* The patch series assumes that the ModifyTable fix discussed at [1]
is already applied.

* I still observe leaks in ProcessGetMemoryContextInterrupt, but
I think the consensus is we should just revert that as not yet ready
for prime time [2].

0001 is the same as before except I did more work on the comments.
I concluded that we were overloading the term "chunk" too much,
so I invented the term "vchunk" for Valgrind's notion of chunks.
(Feel free to suggest other terminology.)

0002 is new work to fix up MemoryContextAllocAligned so it doesn't
cause possible-leak complaints.

The rest are more or less bite-sized fixes of individual problems.
Probably we could squash a lot of them for final commit, but I
thought it'd be easier to review like this. Note that I'm not
expecting 0013 to get applied in this form [3], but without it we
have various gripes about memory leaked from plancache entries.

regards, tom lane

[1] https://www.postgresql.org/message-id/flat/213261.1747611093%40sss.pgh.pa.us
[2] https://www.postgresql.org/message-id/594293.1747708165%40sss.pgh.pa.us
[3] https://www.postgresql.org/message-id/605328.1747710381%40sss.pgh.pa.us

Attachment Content-Type Size
v2-leak-check-fixes.tar.gz application/x-gzip 24.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-05-21 17:17:58 Re: Avoid orphaned objects dependencies, take 3
Previous Message Robert Haas 2025-05-21 17:10:56 Re: [PoC] XMLCast (SQL/XML X025)