[Haskell-cafe] space leak with 'concat' ?

Henning Thielemann lemming at henning-thielemann.de
Tue Jan 27 17:13:45 EST 2009


On Tue, 27 Jan 2009, Henning Thielemann wrote:

>
> On Tue, 27 Jan 2009, Jonathan Cast wrote:
>
>> To show that there's nothing wrong with concat per se, try this version 
>> instead:
>>
>>  ghc +RTS -M16m -c30 -RTS -e 'print $ concat $ repeat "bla"'
>> 
>> This should print forever without any problems.
>
> You are right, this works. My example was extracted from a larger module. But 
> in that module I defined the text to be printed as top-level variable which 
> might have been the problem. But this can't be the problem of the compiled 
> version of the program, where I encountered the leak. So I have to keep on 
> searching that leak.

Yes, the top-level variables seem to be the leak. I had to turn them into 
functions with dummy arguments _and_ attach INLINE pragmas to them in 
order to keep GHC away from buffering their content. Is there a less ugly 
way to achieve this?


More information about the Haskell-Cafe mailing list