From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincent Hanquez Subject: Re: [PATCH 3/4] libxl: add version_info function [and 1 more messages] Date: Mon, 19 Apr 2010 17:41:24 +0100 Message-ID: <4BCC87B4.4010805@eu.citrix.com> References: <4BCB76FD.1020103@amd.com> <4BCB791E.7000204@amd.com> <4BCC0F86.8090707@eu.citrix.com> <19404.30856.176804.871256@mariner.uk.xensource.com> <4BCC7FC4.10800@eu.citrix.com> <19404.33570.623809.702106@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <19404.33570.623809.702106@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: Andre Przywara , "xen-devel@lists.xensource.com" , Keir Fraser , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On 19/04/10 17:21, Ian Jackson wrote: > Vincent Hanquez writes ("Re: [Xen-devel] [PATCH 3/4] libxl: add version_info function [and 1 more messages]"): >> On 19/04/10 16:36, Ian Jackson wrote: >>> I don't think that's correct because memory allocated by libxl_sprintf >>> does not survive return from libxl into the caller. >> >> It survives as long as the context is not ctx_free. i.e. if the data >> need to preserve longer, they will have do be duplicated before freeing >> the context. > > This is sadly not a really tenable behaviour in the long term because > (a) a long-running caller does not want to free the context (and > necessarily reestablish xenstore connections etc. etc.) (b) the caller > may anyway not be able to free the context if doing so frees data they > are still using. This is not perfect, and has a (tiny) cost, but it makes writing the current ocaml bindings (and the future python bindings) much easier and much less memory leak prone. Limiting the number of possible boxes of error type, will definitely help getting XCP ported on libxl. -- Vincent