Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGOnq-0002bL-FB for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Oct 2019 14:43:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iGOnp-0004Cu-6Z for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Oct 2019 14:43:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGOno-0004Cl-R3 for pgsql-hackers@lists.postgresql.org; Fri, 04 Oct 2019 14:43:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iGOnm-00035m-A6 for pgsql-hackers@postgresql.org; Fri, 04 Oct 2019 14:43:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x94EhI1n011239; Fri, 4 Oct 2019 10:43:18 -0400 From: Tom Lane To: Jeff Davis cc: Tomas Vondra , Melanie Plageman , Soumyadeep Chakraborty , Robert Haas , Pg Hackers , soumyadeep2007@gmail.com Subject: Re: Memory Accounting In-reply-to: <0278d32083d051f165c75d605d9fd1a82a197ef8.camel@j-davis.com> References: <67f66d2fa39e35aef90093c74531a38dcd5c0f73.camel@j-davis.com> <20190926192244.mk5ru6nkofo7am3h@development> <57780817877d4b40106b248b63261e21a7a56261.camel@j-davis.com> <20190928221249.mo2jrtlakingnc5e@development> <20190928222206.thidzeygazl7axhg@development> <392e034c1b674a1a58c217dc440ea6197081ccfa.camel@j-davis.com> <20191001021114.iimd77xgnstaww7j@development> <15151.1570163761@sss.pgh.pa.us> <20191004082644.wytixiukkm6ditlu@development> <0278d32083d051f165c75d605d9fd1a82a197ef8.camel@j-davis.com> Comments: In-reply-to Jeff Davis message dated "Fri, 04 Oct 2019 07:32:21 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11237.1570200198.1@sss.pgh.pa.us> Date: Fri, 04 Oct 2019 10:43:18 -0400 Message-ID: <11238.1570200198@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Jeff Davis writes: > On Fri, 2019-10-04 at 10:26 +0200, Tomas Vondra wrote: >> Yeah, I think that's an oversight. Maybe there's a reason why Jeff >> used int64, but I can't think of any. > I had chosen a 64-bit value to account for the situation Tom mentioned: > that, in theory, Size might not be large enough to represent all > allocations in a memory context. Apparently, that theoretical situation > is not worth being concerned about. Well, you could also argue it the other way: maybe in our children's time, int64 won't be as wide as Size. (Yeah, I know that sounds ridiculous, but needing pointers wider than 32 bits was a ridiculous idea too when I started in this business.) The committed fix seems OK to me except that I think you should've also changed MemoryContextMemAllocated() to return Size. regards, tom lane