| 
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
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 |