Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nLSvl-0001QG-Ue for pgsql-bugs@arkaria.postgresql.org; Sat, 19 Feb 2022 16:49:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nLSvk-0004dc-0l for pgsql-bugs@arkaria.postgresql.org; Sat, 19 Feb 2022 16:49:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nLSvj-0004dT-Ol for pgsql-bugs@lists.postgresql.org; Sat, 19 Feb 2022 16:49:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nLSvg-0002v8-Od for pgsql-bugs@lists.postgresql.org; Sat, 19 Feb 2022 16:49:55 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 21JGnmEn059835; Sat, 19 Feb 2022 11:49:48 -0500 From: Tom Lane To: Julien Rouhaud cc: wliang@stu.xidian.edu.cn, pgsql-bugs , david.g.johnston@gmail.com Subject: Re: Re all: Report some potential memory leak bugs in pg_dump.c In-reply-to: <20220219111005.57bfn4qshuqxzkzi@jrouhaud> References: <1f102fb7.f70.17f1102ec92.Coremail.wliang@stu.xidian.edu.cn> <20220219111005.57bfn4qshuqxzkzi@jrouhaud> Comments: In-reply-to Julien Rouhaud message dated "Sat, 19 Feb 2022 19:10:05 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <59833.1645289388.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 19 Feb 2022 11:49:48 -0500 Message-ID: <59834.1645289388@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Julien Rouhaud writes: > Here the amount of leaked memory is likely to be very small (I never hea= rd of > people having thousands of text search templates or parsers), and pg_dum= p isn't > a long lived process so probably no one thought it was worth to extra co= de to > free that memory, which I agree with. Yeah. For context, $ valgrind pg_dump regression >/dev/null reports =3D=3D59330=3D=3D HEAP SUMMARY: =3D=3D59330=3D=3D in use at exit: 3,909,248 bytes in 70,831 blocks =3D=3D59330=3D=3D total heap usage: 546,364 allocs, 475,533 frees, 34,37= 7,280 bytes allocated =3D=3D59330=3D=3D = =3D=3D59330=3D=3D LEAK SUMMARY: =3D=3D59330=3D=3D definitely lost: 6 bytes in 6 blocks =3D=3D59330=3D=3D indirectly lost: 0 bytes in 0 blocks =3D=3D59330=3D=3D possibly lost: 0 bytes in 0 blocks =3D=3D59330=3D=3D still reachable: 3,909,242 bytes in 70,825 blocks =3D=3D59330=3D=3D 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