[Haskell-cafe] Re: ANNOUNCE: parallel-2.0.0.0

Tomáš Janoušek tomi at nomi.cz
Wed Nov 18 19:24:33 EST 2009


Hello,

On Wed, Nov 18, 2009 at 02:21:54PM +0000, Simon Marlow wrote:
> [...]
> is now @a -> a at .  This change helps to fix the space leak described
> in \"Runtime Support for Multicore Haskell\".  The problem is that
> the runtime will currently retain the memory referenced by all
> sparks, until they are evaluated.  Hence, we must arrange to
> evaluate all the sparks eventually, just in case they aren't
> evaluated in parallel, so that they don't cause a space leak.  This
> [...]

I tried to understand the implications of this, read the relevant sections in
the paper, and put together a little piece of code:

> sparkN 0 f = f
> sparkN !n f = (n + 42) `par` sparkN (n-1) f
> 
> main = sparkN 100000000 $ do
>     performGC
>     getLine

I compiled that with GHC 6.10.4 and expected to get a huge space leak, which
didn't happen. What am I doing wrong?

Thanks in advance for any tips.

Regards,
-- 
Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/



More information about the Haskell-Cafe mailing list