Re: Re all: Report some potential memory leak bugs in pg_dump.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: wliang(at)stu(dot)xidian(dot)edu(dot)cn, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, david(dot)g(dot)johnston(at)gmail(dot)com
Subject: Re: Re all: Report some potential memory leak bugs in pg_dump.c
Date: 2022-02-19 16:49:48
Message-ID: 59834.1645289388@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Julien Rouhaud <rjuju123(at)gmail(dot)com> writes:
> Here the amount of leaked memory is likely to be very small (I never heard of
> people having thousands of text search templates or parsers), and pg_dump isn't
> a long lived process so probably no one thought it was worth to extra code to
> free that memory, which I agree with.

Yeah. For context,

$ valgrind pg_dump regression >/dev/null

reports

==59330== HEAP SUMMARY:
==59330== in use at exit: 3,909,248 bytes in 70,831 blocks
==59330== total heap usage: 546,364 allocs, 475,533 frees, 34,377,280 bytes allocated
==59330==
==59330== LEAK SUMMARY:
==59330== definitely lost: 6 bytes in 6 blocks
==59330== indirectly lost: 0 bytes in 0 blocks
==59330== possibly lost: 0 bytes in 0 blocks
==59330== still reachable: 3,909,242 bytes in 70,825 blocks
==59330== suppressed: 0 bytes in 0 blocks

So as long as you're willing to take the regression database as
typical, pg_dump does not have any interesting leak problem.

There are certainly things that this simple test doesn't reach
--- publications/subscriptions are another area besides custom
text search configurations --- but it seems unlikely that a
database would have enough of any of those to justify much worry
about whether those code paths leak anything.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2022-02-19 18:00:02 Re: can't drop table due to reference from orphaned temp function
Previous Message wliang 2022-02-19 12:29:59 Re: Re: Re all: Report some potential memory leak bugs in pg_dump.c