All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
To: "Gianni Tedesco (3P)" <gianni.tedesco@citrix.com>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 0 of 3] libxl: memory leaks
Date: Tue, 03 Aug 2010 14:37:56 +0100	[thread overview]
Message-ID: <4C581BB4.9090901@eu.citrix.com> (raw)
In-Reply-To: <1280837767.18490.153.camel@qabil.uk.xensource.com>

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

  reply	other threads:[~2010-08-03 13:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02 12:31 [PATCH 0 of 3] libxl: memory leaks Ian Campbell
2010-08-02 12:31 ` [PATCH 1 of 3] libxc: free thread specific hypercall buffer on xc_interface_close Ian Campbell
2010-08-02 12:31 ` [PATCH 2 of 3] libxl: fix memory leak in libxl_name_to_domid Ian Campbell
2010-08-02 12:31 ` [PATCH 3 of 3] xl: fix memory leaks in xl create Ian Campbell
2010-08-02 13:11 ` [PATCH 0 of 3] libxl: memory leaks Gianni Tedesco
2010-08-02 13:20   ` Vincent Hanquez
2010-08-02 14:05     ` Gianni Tedesco
2010-08-03  7:59       ` Vincent Hanquez
2010-08-03 10:18         ` Gianni Tedesco
2010-08-03 10:51           ` Vincent Hanquez
2010-08-03 12:16             ` Gianni Tedesco
2010-08-03 13:37               ` Vincent Hanquez [this message]
2010-08-03 14:02                 ` Gianni Tedesco
2010-08-03 14:51                 ` Ian Campbell
2010-08-03 17:07                   ` Stefano Stabellini
2010-08-03 17:11 ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C581BB4.9090901@eu.citrix.com \
    --to=vincent.hanquez@eu.citrix.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=gianni.tedesco@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.