Ashley Yakeley wrote:
If I have a thread that's blocked on an STM retry or TChan read, and
none of its TVars are referenced elsewhere, will it get stopped and
garbage-collected?
I have in mind a pump thread that eternally reads off a TChan and pushes
the result to some function. If the TChan is forgotten elsewhere, will
the permanently blocked thread still sit around using up some small
amount of memory, or will it be reaped by the garbage collector?
In this case, your thread should receive the BlockedIndefinitely exception:
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html#v%3ABlockedIndefinitely
If the system is idle for a certain amount of time (default 0.3s, change it
with the +RTS -I option) a full GC is triggered, which will detect any
threads that are blocked on unreachable objects, and arrange to send them
the BlockedIndefinitely exception.
Cheers,
Simon
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell