From: Ian Jackson Subject: Re: [PATCH 10/31] libxl: Crash (more sensibly) on malloc failure Date: Wed, 11 Apr 2012 12:04:24 +0100 Message-ID: <20357.25912.898502.188820@mariner.uk.xensource.com> References: <1334084885-14474-1-git-send-email-ian.jackson@eu.citrix.com> <1334084885-14474-11-git-send-email-ian.jackson@eu.citrix.com> <1334134921.5394.78.camel@zakaz.uk.xensource.com> <20357.23514.59542.527454@mariner.uk.xensource.com> <1334141224.5394.106.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1334141224.5394.106.camel@zakaz.uk.xensource.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: Ian Campbell Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] [PATCH 10/31] libxl: Crash (more sensibly) on malloc failure"): > On Wed, 2012-04-11 at 11:24 +0100, Ian Jackson wrote: > > Things left to do: > > - Provide versions of malloc, realloc and free which do the > > checking but which do not enroll the pointer in the gc. ... > We got that in the next patch? Yes. I don't think this bullet point is actually helpful in that commit message as it's not so much a deficiency in the code at that point as a thing I was intending to fix when I wrote it, so I have removed it. > > Well, zero isn't adequate :-). So yes, it's arbitrary. 25 is 100 > > bytes (i386) or 200 bytes (amd64) which seems a reasonable initial > > overhead and will probably avoid triggering a realloc too often. > > Why isn't just doubling each time adequate? alloc_maxsize is initialised to 0. Doubling zero gives zero. NB that libxl__ptr_add needs to be rewritten not to be quadratic in the number of pointrs added (!) Ian.