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 1isSiB-0005iz-PA for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Jan 2020 14:35:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1isSiA-000400-Ia for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Jan 2020 14:34:58 +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 1isSiA-0003zt-2x for pgsql-hackers@lists.postgresql.org; Fri, 17 Jan 2020 14:34:58 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1isSi5-0000ks-TL for pgsql-hackers@postgresql.org; Fri, 17 Jan 2020 14:34:56 +0000 Received: by mail-wr1-x441.google.com with SMTP id c14so22923286wrn.7 for ; Fri, 17 Jan 2020 06:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0vsydNwedPJSpofDt3wk5FKylOalWJBza/JFOaPfEqc=; b=Y75VWk8uWev7w9H88aPyT7HJxYSHlc0AWkM78VdiO9lFNQAbTlcKy1BYba3iSG7E9t /6Grr7vSRkEOrtxhuyYZXQzRuJbZf2LG3C65GOcfn966xLJTVthfw0+uLRx+TIwd/NQE zwQd9ymabL16KBm2D3n0n7sVeRk4VSkSrFnITdIfFOO9ZTldAgUVAvIZYz04Gh4j7AaL f52WrDa7dHsnPEGkP+krW8oFy/E4HHFZgPnISqrXyqP+iclcL9c+vWfsvGdl6BfOckZO 4hL7pL0VOtsBk+PlHT6H7HmDbQ5ThudECfwTYqJ/fR1oq6wfJoDvXzFItnuckMpyVBk+ 0juA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0vsydNwedPJSpofDt3wk5FKylOalWJBza/JFOaPfEqc=; b=FW4R1uoMwS1GScrzhLYGG20aq+MB5cYwn7aAfYWdB9YQ0Q3WA1wmuSDkt08G/LSJ9a W3yokROwGkgxA5/TTLj2ZieT41l9ELA2sLNLDwA58h0mTHupAWwSdt//CLkp7vQIxz/R 6E4uqvaQka5Xo9MGOEWTa3LKKWYDXaE55jj+ZvUHtrNrutRPiDyCO1T1/6cswfgCGsZ6 wGrpBGTQDdWJ9kyBeU0Jw7QExMOhKUbTCn4CbBMyFQ8c0lQ08CUh0ubmEopyya8nfxfx UjeGTBNbm+zz6MgjVmpKptFROXNraIEof4DlCjewVKQw2fllV34BmQcX7ghYRc+XWgZo AmIQ== X-Gm-Message-State: APjAAAUH789gQDZvVVRUC1Capod8XI4UFRn9oupD3V5t/9ugfSmppaCH 50799HVw3b1jtsIcYLYdV0Jc09LY1bY= X-Google-Smtp-Source: APXvYqwXoKACkWUsAa/MzaKyoJK4lieS8SG5vtZgbNDGfYyVJ49g4crAacj44Uuy2UvQYfH5ClU3Jg== X-Received: by 2002:a5d:6350:: with SMTP id b16mr3518995wrw.132.1579271692365; Fri, 17 Jan 2020 06:34:52 -0800 (PST) Received: from localhost (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id g25sm3314883wmh.3.2020.01.17.06.34.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 06:34:51 -0800 (PST) Date: Fri, 17 Jan 2020 15:34:50 +0100 From: Tomas Vondra To: Tom Lane Cc: Andres Freund , Tomas Vondra , pgsql-hackers@postgresql.org Subject: Re: SlabCheck leaks memory into TopMemoryContext Message-ID: <20200117143450.3txuxa4t4hw7iuay@development> References: <20200116044119.g45f7pmgz4jmodxj@alap3.anarazel.de> <23952.1579151393@sss.pgh.pa.us> <20200116061732.vvpyexenaortpu5y@alap3.anarazel.de> <27213.1579155900@sss.pgh.pa.us> <20200116064143.opcu2vhcktddpzbh@alap3.anarazel.de> <19743.1579188421@sss.pgh.pa.us> <20200116162500.pcgxmykirm677mt6@development> <563.1579193014@sss.pgh.pa.us> <20200116170432.gkpxd5xxhyodekw7@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200116170432.gkpxd5xxhyodekw7@development> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Jan 16, 2020 at 06:04:32PM +0100, Tomas Vondra wrote: >On Thu, Jan 16, 2020 at 11:43:34AM -0500, Tom Lane wrote: >>Tomas Vondra writes: >>>The attached fix should do the trick - it pre-allocates the space when >>>creating the context. There is a bit of complexity because we want to >>>allocate the space as part of the context header, but nothin too bad. We >>>might optimize it a bit by using a regular bitmap (instead of just an >>>array of bools), but I haven't done that. >> >>Hmm ... so if this is an array of bools, why isn't it declared bool* >>rather than char* ? (Pre-existing ugliness, sure, but we might as >>well fix it while we're here. Especially since you used sizeof(bool) >>in the space calculation.) >> > >True. Will fix. > >>I agree that maxaligning the start point of the array is pointless. >> >>I'd write "free chunks in a block" not "free chunks on a block", >>the latter seems rather shaky English. But that's getting picky. >> >>LGTM otherwise. >> > >OK. Barring objections I'll push and backpatch this later today. > I've pushed and backpatched this all the back back to 10. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services