<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/273818949a6b419c61c9cef3c10d64bf"
  from="David Brown &lt;caml-list@d...&gt;"
  author="David Brown"
  date="2003-12-11T16:57:44"
  subject="Re: [Caml-list] Garbage collection and a reference counting library"
  prev="2003/12/aecf296ada293906c355ef91f393e249"
  next="2003/12/b218a258251a78c1b945b8dfd7846220"
  prev-in-thread="2003/12/222cf89526a65ce589d277efdd2829d4"
  next-in-thread="2003/12/17a764809903dd9118a09590699d8f47"
  prev-thread="2003/12/0a730e95e9a98ca965d70ceb4206faf5"
  next-thread="2003/12/b218a258251a78c1b945b8dfd7846220"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Garbage collection and a reference counting library ">
<msg 
  url="2003/12/23761d3eb8a5f461976c2334cc53cb1c"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-12-11T14:36:46"
  subject="[Caml-list] Garbage collection and a reference counting library ">
<msg 
  url="2003/12/222cf89526a65ce589d277efdd2829d4"
  from="Jean-Christophe Filliatre &lt;filliatr@l...&gt;"
  author="Jean-Christophe Filliatre"
  date="2003-12-11T15:29:27"
  subject="Re: [Caml-list] Garbage collection and a reference counting library ">
<msg 
  url="2003/12/273818949a6b419c61c9cef3c10d64bf"
  from="David Brown &lt;caml-list@d...&gt;"
  author="David Brown"
  date="2003-12-11T16:57:44"
  subject="Re: [Caml-list] Garbage collection and a reference counting library">
</msg>
</msg>
<msg 
  url="2003/12/17a764809903dd9118a09590699d8f47"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2003-12-16T22:54:22"
  subject="Re: [Caml-list] Garbage collection and a reference counting library ">
</msg>
</msg>
</thread>

<contents>
On Thu, Dec 11, 2003 at 04:14:45PM +0100, Jean-Christophe Filliatre wrote:

&gt;  &gt; static value
&gt;  &gt; Val_voidptr (void *ptr)
&gt;  &gt; {
&gt;  &gt;   value rv = alloc (1, Abstract_tag); /* XXX Is this correct? */
&gt;  &gt;   Field(rv, 0) = (value) ptr;
&gt;  &gt;   return rv;
&gt;  &gt; }
&gt; 
&gt; A first remark: to be GC-friendly you have to use CAMLlocal1 to
&gt; declare rv and CAMLreturn instead of return.

Although, it isn't necessary in this situation.  GC only happens on
allocation, so the value 'rv' never has an opportunity to change, so
there is nothing wrong with this function.

But, if you're not sure, it is better to err being too safe rather than
not being safe enough.  Performance is the only issue.

Dave

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

