From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincent Hanquez Subject: Re: [PATCH 0 of 3] libxl: memory leaks Date: Tue, 03 Aug 2010 14:37:56 +0100 Message-ID: <4C581BB4.9090901@eu.citrix.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> <1280837767.18490.153.camel@qabil.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1280837767.18490.153.camel@qabil.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: "Gianni Tedesco (3P)" Cc: Ian Campbell , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 03/08/10 13:16, Gianni Tedesco (3P) wrote: > 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. > How much control do you actually need ? In python you'ld have the approach: my_function_xl_binded() { fill_structure(&structure); CTX_INIT; do_xl_call(&structure); pyval= convert_to_python_values(&structure); CTX_FREE; return pyval; } in OCaml exactly the same. how is that an improvement for python and ocaml bindings that you have to insert the right call in some functions to do some more freeing ? It also save having to generate freeing code. > 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? > it's possible and not very hard, it doesn't mean that should be done though. I really like the braindead approch of after i called libxl_ctx_free, i don't have anything to do with memory by design. You're advocating for having to put the right call in the right functions in the place that need it. -- Vincent