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 1pQaa5-0005gn-5i for pgsql-general@arkaria.postgresql.org; Fri, 10 Feb 2023 21:05:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQaa4-0000Kj-0y for pgsql-general@arkaria.postgresql.org; Fri, 10 Feb 2023 21:05:16 +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 1pQaa3-0000Ka-NF for pgsql-general@lists.postgresql.org; Fri, 10 Feb 2023 21:05:15 +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 1pQaa0-0007pw-SK for pgsql-general@postgresql.org; Fri, 10 Feb 2023 21:05:15 +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 31AL5AFC231810; Fri, 10 Feb 2023 16:05:10 -0500 From: Tom Lane To: noloader@gmail.com cc: Jon Erdman , "pgsql-general@postgresql.org" Subject: Re: valgrind a background worker In-reply-to: References: <01010186386d97a3-f999e4c5-297d-4f89-a904-ced6f236ba6f-000000@us-west-2.amazonses.com> <4076400.1676041432@sss.pgh.pa.us> Comments: In-reply-to Jeffrey Walton message dated "Fri, 10 Feb 2023 15:58:35 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <231808.1676063110.1@sss.pgh.pa.us> Date: Fri, 10 Feb 2023 16:05:10 -0500 Message-ID: <231809.1676063110@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeffrey Walton writes: > On Fri, Feb 10, 2023 at 10:04 AM Tom Lane wrote: >> You have to valgrind the whole cluster AFAIK. Basically, start >> the postmaster under valgrind with --trace-children=yes. >> For leak tracking you probably also want >> --leak-check=full --track-origins=yes --read-var-info=yes > One additional comment... the program in question and PostgreSQL > should also be built with -g -O1 per > https://valgrind.org/docs/manual/quick-start.html . Otherwise, there's > a risk the line information will not be accurate or usable. Yeah. Also, you need to compile Postgres with -DUSE_VALGRIND if you want valgrind to have any idea about palloc/pfree. regards, tom lane