Re: Why our Valgrind reports suck
Tom Lane <tgl@sss.pgh.pa.us>
I wrote: > Here's a v2 patchset that reaches the goal of zero reported leaks > in the core regression tests, with some caveats: Oh, another caveat is that I ran this with a fairly minimalistic set of build options. In a more complete build, I observed a small leak in xml.c, which I posted a fix for in another thread [1]. I also see the leakage Alvaro mentioned with --with-llvm. I'm not sure how real that is though, because AFAICS all of it is reported as "possibly lost", not "definitely lost" or "indirectly lost". In Valgrind-speak that means there are pointers leading to the chunk, just not pointing right at its start. So this could be the result of allocation tricks being played by the C++ compiler. The Valgrind manual talks about some heuristics they use to handle C++ coding patterns, but they don't seem to help in my environment. In any case, the allocation points are mostly far enough down into LLVM functions that if the leaks are real, I'd tend to call them LLVM's bugs not ours. I haven't really tried our non-core test suites yet. Out of curiosity I ran the plperl, plpython, and pltcl suites. All of them show pretty enormous amounts of "possibly lost" data, which again seems likely to be an artifact of allocation games within those libraries rather than real leaks. I wonder if they have "valgrind friendly" build options that we'd need to use to get sane results? regards, tom lane [1] https://www.postgresql.org/message-id/1358967.1747858817%40sss.pgh.pa.us
Commits
-
Undo thinko in commit e78d1d6d4.
- 9d141466ff08 19 (unreleased) landed
-
Avoid leakage of zero-length arrays in partition_bounds_copy().
- 4fbfdde58e4c 19 (unreleased) landed
-
Fix MemoryContextAllocAligned's interaction with Valgrind.
- 9e9190154ef2 19 (unreleased) landed
-
Fix assorted pretty-trivial memory leaks in the backend.
- e78d1d6d47dc 19 (unreleased) landed
-
Improve our support for Valgrind's leak tracking.
- bb049a79d344 19 (unreleased) landed
-
Reduce leakage during PL/pgSQL function compilation.
- 9f18fa999562 19 (unreleased) landed
-
Silence Valgrind leakage complaints in more-or-less-hackish ways.
- db01c90b2f02 19 (unreleased) landed
-
Silence complaints about leaks in PlanCacheComputeResultDesc.
- b102c8c4733c 19 (unreleased) landed
-
Suppress complaints about leaks in TS dictionary loading.
- 7f6ededa764b 19 (unreleased) landed
-
Suppress complaints about leaks in function cache loading.
- 2c7b4ad24dda 19 (unreleased) landed
-
Fix per-relation memory leakage in autovacuum.
- e087b5b79452 16.10 landed
- 13d21b48a3a4 15.14 landed
- cd3064f9898c 17.6 landed
- 02502c1bca54 18.0 landed
-
Fix AlignedAllocRealloc to cope sanely with OOM.
- ac3afd1d0079 17.6 landed
- 6aa33afe6da1 18.0 landed