Space leak question

2011-07-24 Thread Will Ness
Hello, in reformulation of a code with no space leak, the leak reappeares. It takes near constant space to get at the n-th elt in the produced list here (http://ideone.com/fiifl): {-# OPTIONS_GHC -O2 -fno-cse #-} primes = 2 : ([3,5..] `minus` foldi (\(x:xs) - (x:) . union xs)

Understanding behavior of BlockedIndefinitelyOnMVar exception

2011-07-24 Thread Brandon Simmons
I'm trying to really understand how the BlockedIndefinitelyOnMVar exception works in concurrent code as I would like to rely on it as a useful runtime signal in a concurrency library I'm working on. Here is some code illustrating a function restoring an abandoned lock in a single-threaded program

Re: Understanding behavior of BlockedIndefinitelyOnMVar exception

2011-07-24 Thread Felipe Almeida Lessa
On Sun, Jul 24, 2011 at 7:56 PM, Brandon Simmons brandon.m.simm...@gmail.com wrote: What I think I've learned here is that the BlockedIndefinitelyOnMVar exception is raised in all the blocked threads at once as it were. That despite the fact that the handler code in 'lockPrint' restores the

Re: Understanding behavior of BlockedIndefinitelyOnMVar exception

2011-07-24 Thread Edward Z. Yang
Excerpts from Felipe Almeida Lessa's message of Sun Jul 24 22:02:36 -0400 2011: Does anything change if you somehow force a GC sometime after good2? Perhaps with some calculation generating garbage, perhaps with performGC. IIRC, the runtime detects BlockedIndefinitelyOnMVar on GC. But I'm