From: Gianni Tedesco Subject: Re: [PATCH 0 of 3] libxl: memory leaks Date: Tue, 3 Aug 2010 13:16:07 +0100 Message-ID: <1280837767.18490.153.camel@qabil.uk.xensource.com> References: <1280754703.18490.65.camel@qabil.uk.xensource.com> <4C56C60D.5060702@eu.citrix.com> <1280757928.18490.72.camel@qabil.uk.xensource.com> <4C57CC53.7030107@eu.citrix.com> <1280830700.18490.82.camel@qabil.uk.xensource.com> <4C57F4C3.9090205@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4C57F4C3.9090205@eu.citrix.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: Vincent Hanquez Cc: Ian Campbell , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Tue, 2010-08-03 at 11:51 +0100, Vincent Hanquez wrote: > On 03/08/10 11:18, Gianni Tedesco (3P) wrote: > > I wasn't aware that was the original design. It's certainly not the case > > right now. > > it has unfortunately diverged in some calls indeed. > > > AFAICS that scheme would only guarantee everything has been freed if the > > caller calls ctx_free() at appropriate points. If libxl were used in a > > daemon, for example, it would not be simple to come up with a scheme > > that guarantees memory bounds that are independent from uptime. > > This scheme is already in place in the ocaml binding I actually prefer explicit free's on the returned objects. That gives callers a lot more control. Have you seen Ians patch auto-generating that code? I think this approach combined with automatic-freeing of scratch data used in libxl calls is the best of both worlds. I don't know about ocaml but assume it's trivial to call a libxl_*_free function when an object which encapsulates a libxl returned object is destroyed?