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 1q1VpR-0006q8-B7 for pgsql-hackers@arkaria.postgresql.org; Tue, 23 May 2023 17:29:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q1VoS-0004yq-3M for pgsql-hackers@arkaria.postgresql.org; Tue, 23 May 2023 17:28:44 +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 1q1VoR-0004yZ-Qg for pgsql-hackers@lists.postgresql.org; Tue, 23 May 2023 17:28:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q1VoK-001h6w-BG for pgsql-hackers@lists.postgresql.org; Tue, 23 May 2023 17:28:43 +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 34NHSUkW965728; Tue, 23 May 2023 13:28:30 -0400 From: Tom Lane To: Andres Freund cc: Tomas Vondra , PostgreSQL Hackers Subject: Re: memory leak in trigger handling (since PG12) In-reply-to: <20230523171433.earidmyzock7fnk4@awork3.anarazel.de> References: <222a3442-7f7d-246c-ed9b-a76209d19239@enterprisedb.com> <20230523171433.earidmyzock7fnk4@awork3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 23 May 2023 10:14:33 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <965726.1684862910.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 23 May 2023 13:28:30 -0400 Message-ID: <965727.1684862910@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > I've wondered about some form of instrumentation to detect such issues > before. Yeah. > Could it help to have a mode where the executor shutdown hook checks how= much > memory is allocated in ExecutorState and warns if its too much? It'd be very hard to set a limit for what's "too much", since the amount of stuff created initially will depend on the plan size. In any case I think that the important issue is not how much absolute space, but is there per-row leakage. I wonder if we could do something involving checking for continued growth after the first retrieved tuple, or something like that. > Random aside: I've been wondering whether it'd be worth introducing an > in-place representation of Bitmap (e.g. if the low bit is set, the low 6= 3 bits > are in-place, if unset, it's a pointer). Why? Unlike Lists, those things are already a single palloc chunk. regards, tom lane