From: Ian Jackson Subject: Re: [PATCH 2/2] libxl: Have flexarray using the GC Date: Mon, 1 Oct 2012 15:17:33 +0100 Message-ID: <20585.42493.151224.551455@mariner.uk.xensource.com> References: <1348666294-18182-1-git-send-email-anthony.perard@citrix.com> <1348666294-18182-3-git-send-email-anthony.perard@citrix.com> <20581.56805.294140.556698@mariner.uk.xensource.com> <5069A56B.4000605@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5069A56B.4000605@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Anthony PERARD Cc: Ian Jackson , Ian Campbell , Xen Devel List-Id: xen-devel@lists.xenproject.org Anthony PERARD writes ("Re: [Xen-devel] [PATCH 2/2] libxl: Have flexarray using the GC"): > On 09/28/2012 06:27 PM, Ian Jackson wrote: > > If gc is NOGC then this does the wrong thing. Callers should be able > > to specify NOGC for a flexarray which they want to survive across > > multiple calls into libxl. > > I'm not sure I see your point here. If a something needs a NOGC'ed > flexarray, then flexarray_make(NOGC, x, x) will give this. So then you put the flexarray in some long-term data structure, which survives the call to libxl and therefore the gc. Is it safe for NOGC's gc*, derived from the now-destroyed actual gc, to be embedded in the flexarray and reused later in a different libxl call with a different gc (but the same ctx) ? > > For this all to work correctly, including error handling, I think > > flexarray_grow and its callers need to take a gc from the context. It > > would be wise to assert that the either 1. both the gc passed to make > > and grow are NOGC or 2. they are the same. > > All right, I'll add gc to _grow and it's caller. And will assert on both > condition. Feel free instead to explain to me why I'm wrong :-). Ian.