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 1h47qU-0002TP-4O for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Mar 2019 17:39:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h47pU-0003Gd-SU for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Mar 2019 17:38:12 +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 1h47pU-0003Dl-Hk for pgsql-hackers@lists.postgresql.org; Wed, 13 Mar 2019 17:38:12 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h47pN-0006hd-LD for pgsql-hackers@lists.postgresql.org; Wed, 13 Mar 2019 17:38:11 +0000 Received: by mail-qt1-x844.google.com with SMTP id d2so2854110qti.11 for ; Wed, 13 Mar 2019 10:38:05 -0700 (PDT) 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:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=3pkTxjF2vVGycTIQcUcbtw6g1PgGCOr3QmPKIgGR3mk=; b=ScXxhzVwRvX5rusp0bhse+tPp+ZQ1Qc3wvSq0waHkIMGLU1cdPyuR1GWkfc4YEmUA3 dcPB5nvLUVarr0yJixMvgysZP70oekbQpoLtWuoBTQsJpImDXArESJLVgtK9F82PY4Ig PBazu6eX/0PO9XKvBpD6dZk/DrJRGtQJAmlMGXhmJ9BhZDT8RQfmFPEima5q01C8qWGd RZb1KiXBpr7A+3nKk/LniY7N2Xe4WasT/LmfQpZbZr9PqAh5pcSrxuLEjGNACI/DPyxR 4qV54nzHMBHWDw7xVMKTtbRI/FGTiY90bwBwqyncj/D5KvYTyHkC11Tftbslo7pwFgRA 8psg== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=3pkTxjF2vVGycTIQcUcbtw6g1PgGCOr3QmPKIgGR3mk=; b=sfZ2yKcoOfYrQytSNLs02tYFmsDE2dz8nWvx5niK3b110Ia7yJ6LxUtnsO8SCurSOq GVX5qNhPhzRDVAI2QPAccofvZJ1CxqG/t6qnAYZ+dXs5GxUog+sBR+104hhoPjaSTzNR 0C4k1ZR8qpBUfyPTEuffDDyRxZzsiwfQW5RT938Xdwet5Jf+XKq9kpgWSWZs23Wf542M U0pcJbIx9vjDW9v1QToHlI1xN3NPlDV0UtBXqcg73mMnCPDgKXTPQ/8AxXYOFwevxU9u 3V28xThXHR1cKSRowde31swFWD7RWMGDrAariEpAAR97lnu6IgyEd1+LeYQFwHcqWuMN 1OPg== X-Gm-Message-State: APjAAAW079opmqRkUWyeEwsn6SlCjLtQyLBf5PhC2RlZGU9L5FhpU+J2 JQwG8XBcdkl4TLGj1sT4P0p49A== X-Google-Smtp-Source: APXvYqxjscl8Hm5FOU/3qgId+Meb4yCDLUfKx2UQHREFt29vGhOLlgvhcc0e42WbFdnp7gFM7cgSYg== X-Received: by 2002:a0c:9910:: with SMTP id h16mr35794792qvd.245.1552498684803; Wed, 13 Mar 2019 10:38:04 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id p189sm7295867qkf.20.2019.03.13.10.38.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Mar 2019 10:38:04 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 2CD4E121C9A; Wed, 13 Mar 2019 14:38:02 -0300 (-03) Date: Wed, 13 Mar 2019 14:38:02 -0300 From: Alvaro Herrera To: Robert Haas Cc: PostgreSQL Hackers Subject: Re: hyrax vs. RelationBuildPartitionDesc Message-ID: <20190313173802.GA24768@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Mar-13, Robert Haas wrote: > On Wed, Mar 13, 2019 at 12:42 PM Alvaro Herrera > wrote: > > I remember going over this code's memory allocation strategy a bit to > > avoid the copy while not incurring potential leaks CacheMemoryContext; > > as I recall, my idea was to use two contexts, one of which is temporary > > and used for any potentially leaky callees, and destroyed at the end of > > the function, and the other contains the good stuff and is reparented to > > CacheMemoryContext at the end. So if you have any accidental leaks, > > they don't affect a long-lived context. You have to be mindful of not > > calling leaky code when you're using the permanent one. > > Well, that assumes that the functions which allocate the good stuff do > not also leak, which seems a bit fragile. A bit, yes, but not overly so, and it's less fragile that not having such a protection. Anything that allocates in CacheMemoryContext needs to be very careful anyway. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services