Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHtKD-0000eq-8t for pgsql-committers@arkaria.postgresql.org; Thu, 23 Nov 2017 15:22:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHtKC-0002h6-Ej for pgsql-committers@arkaria.postgresql.org; Thu, 23 Nov 2017 15:22:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eHtEj-00080M-Hf for pgsql-committers@lists.postgresql.org; Thu, 23 Nov 2017 15:16:21 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eHtEd-0006Fb-DI for pgsql-committers@postgresql.org; Thu, 23 Nov 2017 15:16:20 +0000 X-Originating-IP: 212.24.157.174 Received: from [10.137.1.13] (unknown [212.24.157.174]) (Authenticated sender: tv@fuzzy.cz) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id C04F641C093; Thu, 23 Nov 2017 16:16:10 +0100 (CET) Subject: Re: pgsql: Generational memory allocator To: Simon Riggs , Andres Freund Cc: pgsql-committers References: <20171123001649.y2nf7422iay6cw3v@alap3.anarazel.de> From: Tomas Vondra Message-ID: Date: Thu, 23 Nov 2017 16:16:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------CCF850BE5769E8B5375FF91B" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------CCF850BE5769E8B5375FF91B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 11/23/2017 10:57 AM, Simon Riggs wrote: > On 23 November 2017 at 11:16, Andres Freund wrote: >> Hi, >> >> On 2017-11-22 18:48:19 +0000, Simon Riggs wrote: >>> Generational memory allocator >>> >>> Add new style of memory allocator, known as Generational >>> appropriate for use in cases where memory is allocated >>> and then freed in roughly oldest first order (FIFO). >>> >>> Use new allocator for logical decoding’s reorderbuffer >>> to significantly reduce memory usage and improve performance. >> >> Looks like it's not quite valgrind clean: >> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=skink&dt=2017-11-22%2022%3A30%3A01 > > It doesn't report anything useful that would allow me to fix this. > > Please enable some info reporting on the animal. > I agree it would be useful to get the valgrind log from the animal, but I guess you'd need to get valgrind working to fix the issue anyway. Anyway, the attached patch fixes the issues for me - strictly speaking the Assert is not needed, but it doesn't hurt. regards Tomas --------------CCF850BE5769E8B5375FF91B Content-Type: text/x-patch; name="genalloc-valgrind-fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="genalloc-valgrind-fix.patch" diff --git a/src/backend/utils/mmgr/generation.c b/src/backend/utils/mmgr/generation.c index cdff20f..3e3cacd 100644 --- a/src/backend/utils/mmgr/generation.c +++ b/src/backend/utils/mmgr/generation.c @@ -402,9 +402,14 @@ GenerationAlloc(MemoryContext context, Size size) chunk = (GenerationChunk *) block->freeptr; + /* Prepare to initialize the chunk header. */ + VALGRIND_MAKE_MEM_UNDEFINED(chunk, Generation_CHUNKHDRSZ); + block->nchunks += 1; block->freeptr += (Generation_CHUNKHDRSZ + chunk_size); + Assert(block->freeptr <= block->endptr); + chunk->block = block; chunk->context = set; --------------CCF850BE5769E8B5375FF91B--