[Haskell-cafe] Loading a texture in OpenGL

Clark Gaebel cgaebel at csclub.uwaterloo.ca
Tue Feb 7 05:20:05 CET 2012


Even the next major, manually triggered GC? I'm just dealing with GHC here,
if that simplifies the discussion.

Although important and good to know, I don'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.

Also, afaik, the performGC function is a GHC extension anyways.


On Mon, Feb 6, 2012 at 11:16 PM, Austin Seipp <mad.one at gmail.com> wrote:

> It's a precise GC of course (conservative collection would be madness
> considering how much memory Haskell programs chew through.) That still
> doesn't ensure your finalizer will run during the next GC even if all the
> references are gone by then.
>
> Sent from my iPhone^H^H^H^H^HPortable Turing machine
>
> On Feb 6, 2012, at 10:09 PM, Clark Gaebel <cgaebel at csclub.uwaterloo.ca>
> wrote:
>
> Is the Haskell garbage collector conservative, or precise?
>
> If it's conservative, then this will only usually work. If it's precise,
> it should always work.
>
> On Mon, Feb 6, 2012 at 10:56 PM, Ben Lippmeier <benl at ouroborus.net> wrote:
>
>>
>> On 07/02/2012, at 2:50 PM, Clark Gaebel wrote:
>>
>> > 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.
>>
>>
>> From the docs:
>>
>> newForeignPtr :: FinalizerPtr a -> Ptr a -> IO (ForeignPtr a)Source
>> 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.
>>
>>
>> "No guarantee of promptness". 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.
>>
>> Ben.
>>
>>
>>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120206/ed6bd3fa/attachment.htm>


More information about the Haskell-Cafe mailing list