Interpret: Create a blackhole while evaluating a thunk
Bug #584875 reported by
Matt Giuca
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mars |
Triaged
|
Wishlist
|
Matt Giuca |
Bug Description
Haskell's G-machine uses a "blackhole" [1] to avoid space leaks and detect certain forms of nontermination. We can do the same quite easily.
Before evaluating a thunk, extract the value from the localtable and replace it with a "blackhole" node (containing no data). This allows the garbage collector to collect anything referenced by the thunk, which it would otherwise be unable to collect. If you have to evaluate a blackhole, just raise an error, as it indicates infinite recursion in thunk evaluation.
[1] Jones, Richard. Tail Recursion Without Space Leaks
http://
To post a comment you must log in.