caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
To: Jez <jezreel@gmail.com>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] When to (not) use -no-naked-pointers?
Date: Mon, 25 May 2015 23:49:16 +0200	[thread overview]
Message-ID: <CAHvkLrPehoTDNn6qS-iM-6gQupr3GheOiNgqErZTW_XLF8707A@mail.gmail.com> (raw)
In-Reply-To: <CABVpgLXPre+Q62RasDgjUPS_f2+7mPYSsvn+wBxvWTwnh2SrZQ@mail.gmail.com>

Hi,

  Naked pointers only appear in C bindings when pointers to C
structures are passed directly as OCaml values. Non-naked pointers are
the ones which are hidden within either a custom block or a block with
the "abstract" tag (Tag_abstract). It is normally easy to modify a
binding to switch from naked-pointers to non-naked pointers (it could
even be a configure script option of the binding). The only case where
there is a (big) problem is when the binding is allocating OCaml
values outside of the heap: it is the case for the "ancient" library,
for example, that copies OCaml values outside of the heap to avoid
garbage collections; it is also the case for some bindings that create
OCaml string headers in front of C buffers, to be able to manipulate
them directly in OCaml (I did that once to share OCaml strings between
processes, using shared memory).

--Fabrice
INRIA &OCamlPro


On Mon, May 25, 2015 at 8:25 AM, Jez <jezreel@gmail.com> wrote:
> Hi,
>
> I noticed that 4.02 now has the no-naked-pointers option. I'd like to better
> understand when I shouldn't use it -- i.e. what kinds of operations create
> naked pointers? I suppose that these pointers can only be generated by C
> code; an example of when their use may arise would be nice :)
>
> Jez



-- 
Fabrice LE FESSANT
Chercheur en Informatique
INRIA Paris Rocquencourt -- OCamlPro
Programming Languages and Distributed Systems

  reply	other threads:[~2015-05-25 21:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-25  6:25 Jez
2015-05-25 21:49 ` Fabrice Le Fessant [this message]
2015-05-26 15:42   ` Mark Shinwell
2015-05-26 17:21     ` ygrek
2015-07-05  2:40       ` ygrek

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=CAHvkLrPehoTDNn6qS-iM-6gQupr3GheOiNgqErZTW_XLF8707A@mail.gmail.com \
    --to=fabrice.le_fessant@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=jezreel@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).