<font face="verdana,sans-serif">Even the next major, manually triggered GC? I&#39;m just dealing with GHC here, if that simplifies the discussion.<br><br>Although important and good to know, I don&#39;t really care what the spec says here. I just want to know if, with the current implementation of GHC, finalizeres will be run if a GC is manually triggered and there are no references to the objects they point to.<br>

<br>Also, afaik, the performGC function is a GHC extension anyways.<br><br></font><br><div class="gmail_quote">On Mon, Feb 6, 2012 at 11:16 PM, Austin Seipp <span dir="ltr">&lt;<a href="mailto:mad.one@gmail.com">mad.one@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF"><div>It&#39;s a precise GC of course (conservative collection would be madness considering how much memory Haskell programs chew through.) <span>That still doesn&#39;t ensure your finalizer will run during the next GC even if all the references are gone by then.</span></div>


<div><br>Sent from my iPhone^H^H^H^H^HPortable Turing machine</div><div><div class="h5"><div><br>On Feb 6, 2012, at 10:09 PM, Clark Gaebel &lt;<a href="mailto:cgaebel@csclub.uwaterloo.ca" target="_blank">cgaebel@csclub.uwaterloo.ca</a>&gt; wrote:<br>

<br></div>
<div></div><blockquote type="cite"><div><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" target="_blank">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><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><font color="#888888"><br>
Ben.<br>
<br>
<br>
</font></span></blockquote></div><br>
</div></blockquote></div></div><div class="im"><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Haskell-Cafe mailing list</span><br><span><a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a></span><br>


<span><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a></span><br></div></blockquote></div></div>
</blockquote></div><br>