[Haskell] Blocked STM & GC question

Simon Peyton-Jones simonpj at microsoft.com
Mon Sep 17 08:46:41 EDT 2007


[Redirecting to GHC Users which is the right place for questions about GHC.]

Yes, the garbage collector will (well, certainly should) find and kill such threads.  By "kill" I mean that they get sent an asynchronous exception of some kind (I hope the documentation says which) so that the thread has a chance to clean up rather than being forcibly terminated.

I'm not quite sure where this fact should be documented -- documentation for GHC itself, or for the STM library? -- but it surely should be somewhere.

Simon

| -----Original Message-----
| From: haskell-bounces at haskell.org [mailto:haskell-bounces at haskell.org]
| On Behalf Of Ashley Yakeley
| Sent: 15 September 2007 21:39
| To: haskell at haskell.org
| Subject: [Haskell] Blocked STM & GC question
|
| 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?
|
| --
| Ashley Yakeley
| Seattle WA
|
| _______________________________________________
| Haskell mailing list
| Haskell at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell


More information about the Glasgow-haskell-users mailing list