Why are strings linked lists?

Tomasz Zielonka t.zielonka at students.mimuw.edu.pl
Mon Dec 8 15:13:48 EST 2003


On Mon, Dec 08, 2003 at 01:45:30PM -0000, Simon Marlow wrote:
>  
> > On Sat, Nov 29, 2003 at 11:10:57AM -0500, Wojtek Moczydlowski wrote:
> > > 
> > > (though it still bothers me that I don't have an answer yet to the
> > > memory leak I posted some time ago)
> > 
> > If you are talking about StateT space leak, then I think I have given
> > you an answer. My guess was that it is a CAF leak.
> 
> GHC doesn't have CAF leaks.  Next guess :-)

Even in unoptimized, byte-code compiled code?

Take this module:

    module A where

    t :: IO ()
    t = sequence_ (repeat (return ()))

If I :load it into ghci as interpreted, or if I compile it without
optimisation options, and I run t, then the process grows, and grows,
and grows, ...

Of course, when I first compile it with -O2 option then it runs in
constant space.

When I compiled Wojtek's code with -O2, the problem disappeared, so I
guess he was loading the module without compiling it with -O2 first.

Shouldn't you rather say: GHC doesn't have CAF leaks in code compiled
with [insert the relevand optimisation option here] option?

Case closed!

Or I am still wrong?

> Cheers,
> 	Simon

Best regards,
Tom

-- 
.signature: Too many levels of symbolic links


More information about the Haskell mailing list