Re: Why our Valgrind reports suck

2025-05-12 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > On 2025-May-11, Tom Lane wrote: >> In particular, I had not realized that autovacuum >> leaks a nontrivial amount of memory per relation processed (cf 0009), >> and apparently has done for a few releases now. This is horrid in >> databases with many table

Re: Why our Valgrind reports suck

2025-05-12 Thread Álvaro Herrera
On 2025-May-11, Tom Lane wrote: > Okay, here is a patch series that updates the > 0001-Make-memory-contexts-themselves-more-visible-to-valg.patch > patch you posted in that thread, and makes various follow-up > fixes that either fix or paper over various leaks. Wow, that's a lot of extra fixes.

Re: Why our Valgrind reports suck

2025-05-11 Thread Tom Lane
I wrote: > Okay, here is a patch series that updates the > 0001-Make-memory-contexts-themselves-more-visible-to-valg.patch > patch you posted in that thread, I forgot to mention that I did try to implement the "two-level pool" scheme that the Valgrind documentation talks about, and could not make

Re: Why our Valgrind reports suck

2025-05-11 Thread Tom Lane
I wrote: > And, since there's nothing new under the sun around here, > we already had a discussion about that back in 2021: > https://www.postgresql.org/message-id/flat/3471359.1615937770%40sss.pgh.pa.us > That thread seems to have led to fixing some specific bugs, > but we never committed any of t

Re: Why our Valgrind reports suck

2025-05-09 Thread Tom Lane
I wrote: > One thing I noticed while reading the Valgrind manual is that > they describe a facility for "two level" tracking of custom > allocators such as ours. And, since there's nothing new under the sun around here, we already had a discussion about that back in 2021: https://www.postgresql.o

Re: Why our Valgrind reports suck

2025-05-09 Thread Tom Lane
Andres Freund writes: > On 2025-05-08 22:04:06 -0400, Tom Lane wrote: >> A nearby thread [1] reminded me to wonder why we seem to have >> so many false-positive leaks reported by Valgrind these days. > Huh. We use the memory pool client requests to inform valgrind about memory > contexts. I seem

Re: Why our Valgrind reports suck

2025-05-09 Thread Tom Lane
Andres Freund writes: > Briefly looking through the leaks indeed quickly found a real seeming leak, > albeit of limited size: > ProcessStartupPacket() does > buf = palloc(len + 1); > in TopMemoryContext() without ever freeing it. Yeah, I saw that too. Didn't seem worth doing anything about

Re: Why our Valgrind reports suck

2025-05-09 Thread Andres Freund
Hi, On 2025-05-09 11:29:43 -0400, Andres Freund wrote: > We currently don't reset TopMemoryContext at exit, which, obviously, does > massively increase the number of leaks. But OTOH, without that there's not a > whole lot of value in the leak check... Briefly looking through the leaks indeed quic

Re: Why our Valgrind reports suck

2025-05-09 Thread Andres Freund
Hi, On 2025-05-08 22:04:06 -0400, Tom Lane wrote: > A nearby thread [1] reminded me to wonder why we seem to have > so many false-positive leaks reported by Valgrind these days. > For example, at exit of a backend that's executed a couple of > trivial queries, I see > > ==00:00:00:25.515 260013==

Re: Why our Valgrind reports suck

2025-05-09 Thread Yasir
On Fri, May 9, 2025 at 7:04 AM Tom Lane wrote: > A nearby thread [1] reminded me to wonder why we seem to have > so many false-positive leaks reported by Valgrind these days. > For example, at exit of a backend that's executed a couple of > trivial queries, I see > > ==00:00:00:25.515 260013== LE