Re: Valgrind - showing memory leaks

From: Yasir <yasir(dot)hussain(dot)shah(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Valgrind - showing memory leaks
Date: 2025-05-08 19:57:19
Message-ID: CAA9OW9dD4r4MwQGrZ725QGB1WmEMqg90E-90UvfiQKMZbbqbXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 8, 2025 at 7:27 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Yasir <yasir(dot)hussain(dot)shah(at)gmail(dot)com> writes:
> > I believe that the valgrind should not report any memory leaks in such
> > simple/common commands. What am I doing wrong here?
>
> I think you are vastly overestimating both the intelligence of
> valgrind, and our level of concern about minor one-time leaks.
> Most of these are probably not really leaks at all, but failure
> on valgrind's part to notice the relevant pointers. Moreover,
> almost all are blamed on catcache setup, which is a one-time
> operation; so even if it is losing track of some allocations,
> it's not likely to be something worth worrying about.
>
> Alvaro seems to think CheckNNConstraintFetch is worth taking
> a second look at, and maybe he's right, but the amount of
> storage involved there seems unexciting too.
>
> regards, tom lane
>

Makes sense, these look like valgrind false positives tied to long-lived
allocations.
Since Alvaro flagged CheckNNConstraintFetch, I’ll leave it to him to take a
closer look if he still thinks it’s worth digging into.

Best,
Yasir
Data Bene

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniele Varrazzo 2025-05-08 20:01:18 Re: Fix PQport to never return NULL if the connection is valid
Previous Message Yasir 2025-05-08 19:51:43 Re: Valgrind - showing memory leaks