Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIgpu-00011S-RR for pgsql-committers@arkaria.postgresql.org; Sat, 25 Nov 2017 20:14:02 +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 1eIgpt-0001Fy-RE for pgsql-committers@arkaria.postgresql.org; Sat, 25 Nov 2017 20:14:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eIgpt-0001Fo-MV for pgsql-committers@lists.postgresql.org; Sat, 25 Nov 2017 20:14:01 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eIgpq-0006nm-HR for pgsql-committers@postgresql.org; Sat, 25 Nov 2017 20:14:01 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 5905520ADC; Sat, 25 Nov 2017 15:13:57 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sat, 25 Nov 2017 15:13:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=6TFNknu4lxPSgBkinfmMunVbjx5Tp CDFBlnIcaxkIxs=; b=JJMaA7NBCLBGeNYM+1Pt6wJerCpZr6w8cTHsAAQQLZoyN 3tVrHO/Dm2yBHhurhVwLe4cPkwsPPt0Bvjbe54tZIOY5jbT+PWsotYBIxd/z+Ykf Bkg0428nK9ztAlpd29Eg0KvUjtwoTdcaMUSsQq9a9I6SRmrOwHS3bsJ3OA4mUcKy vgWOgSgUZVMa55SIL18GkjNNVZ5IpfVkenw4iiwmoPoXhfEyFPeyAsE6plgPa9dN 0L38yVhmQIHfTiGN6XWje3kTYf+0S6a4y+TvY2O4QVa+bgUgj5wR4lt0SAEdRurN NeJGEbb9W4rhwyCTHxJSm4Nb4wdb68jpBMzs4fLTQ== X-ME-Sender: Received: from intern.anarazel.de (unknown [136.24.76.189]) by mail.messagingengine.com (Postfix) with ESMTPA id 11FF87E6B8; Sat, 25 Nov 2017 15:13:57 -0500 (EST) Date: Sat, 25 Nov 2017 12:13:56 -0800 From: Andres Freund To: Tom Lane Cc: Tomas Vondra , Simon Riggs , pgsql-committers Subject: Re: pgsql: Generational memory allocator Message-ID: <20171125201356.2dydqrlf2qktlog6@alap3.anarazel.de> References: <20171123001649.y2nf7422iay6cw3v@alap3.anarazel.de> <16449.1511548313@sss.pgh.pa.us> <4618.1511573138@sss.pgh.pa.us> <6189.1511587105@sss.pgh.pa.us> <8991.1511639441@sss.pgh.pa.us> <20171125200014.qbewtip5oydqsklt@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171125200014.qbewtip5oydqsklt@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2017-11-25 12:00:15 -0800, Andres Freund wrote: > Hi, > > On 2017-11-25 14:50:41 -0500, Tom Lane wrote: > > I wrote: > > > Tomas Vondra writes: > > >> BTW I also see these failures in hstore: > > > > >> ==15168== Source and destination overlap in memcpy(0x5d0fed0, 0x5d0fed0, 40) > > >> ==15168== at 0x4C2E00C: memcpy@@GLIBC_2.14 (vg_replace_strmem.c:1018) > > >> ==15168== by 0x15419A06: hstoreUniquePairs (hstore_io.c:343) > > >> ==15168== by 0x15419EE4: hstore_in (hstore_io.c:416) > > > > > Huh ... > > > > I tried to duplicate this on my RHEL6 workstation, and failed to, > > even though adding an assertion easily proves that the hstore > > regression test does exercise the case. So apparently the answer > > as to why skink isn't reporting this is just "not all versions of > > valgrind check it". > > I suspect that the issue rather is that the compiler will sometimes > replace the memcpy() with an in-line member-by-member version. That'll > not be visible as a memcpy to valgrind. That's indeed the case. Here's the disassembly from skink, albeit for v10, because those objects were currently present: disassemble /s hstoreUniquePairs ... 342 res++; 0x00000000000005c2 <+174>: add $0x28,%rbx 343 memcpy(res, ptr, sizeof(Pairs)); 0x00000000000005c6 <+178>: mov (%r12),%rax 0x00000000000005ca <+182>: mov 0x8(%r12),%rdx 0x00000000000005cf <+187>: mov %rax,(%rbx) 0x00000000000005d2 <+190>: mov %rdx,0x8(%rbx) 0x00000000000005d6 <+194>: mov 0x10(%r12),%rax 0x00000000000005db <+199>: mov 0x18(%r12),%rdx 0x00000000000005e0 <+204>: mov %rax,0x10(%rbx) 0x00000000000005e4 <+208>: mov %rdx,0x18(%rbx) 0x00000000000005e8 <+212>: mov 0x20(%r12),%rax 0x00000000000005ed <+217>: mov %rax,0x20(%rbx) 344 } 345 ... Greetings, Andres Freund