<font face="verdana,sans-serif">Is the Haskell garbage collector conservative, or precise?<br><br>If it&#39;s conservative, then this will only usually work. If it&#39;s precise, it should always work.<br></font><br><div class="gmail_quote">

On Mon, Feb 6, 2012 at 10:56 PM, Ben Lippmeier <span dir="ltr">&lt;<a href="mailto:benl@ouroborus.net">benl@ouroborus.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im"><br>
On 07/02/2012, at 2:50 PM, Clark Gaebel wrote:<br>
<br>
&gt; I would be running the GC manually at key points to make sure it gets cleaned up. Mainly, before any scene changes when basically everything gets thrown out anyways.<br>
<br>
<br>
</div>From the docs:<br>
<br>
newForeignPtr :: FinalizerPtr a -&gt; Ptr a -&gt; IO (ForeignPtr a)Source<br>
Turns a plain memory reference into a foreign pointer, and associates a finalizer with the reference. The finalizer will be executed after the last reference to the foreign object is dropped. There is no guarantee of promptness, however the finalizer will be executed before the program exits.<br>


<br>
<br>
&quot;No guarantee of promptness&quot;. Even if the GC knows your pointer is unreachable, it might choose not to call the finaliser. I think people have been bitten by this before.<br>
<span class="HOEnZb"><font color="#888888"><br>
Ben.<br>
<br>
<br>
</font></span></blockquote></div><br>