[MLton] callcc and space use

Matthew Fluet fluet at tti-c.org
Wed Jan 23 10:12:28 PST 2008


On Wed, 23 Jan 2008, Matthew Fluet wrote:
>> >   Glancing at the programs, I quickly spotted one place where you might
>> >   have a "leak" (I don't yet understand the whole program), and this
>> >   differs between the two versions of the program you sent....
>>
>>  Thanks for pointing that out.  Unfortunately, it doesn't seem to make much
>>  difference.  I.e. the non-leaky one stays non-leaky even if I make it
>>  non-tail recursive, and the leaky one stays leaky even if I make it tail
>>  recursive.  That function ("loop") doesn't have much state, so even if it
>>  was leaking frames on the stack, it should only be a linear overhead.
>
> I believe that MLton will recognize that the loop function never returns 
> normally, and so the

[accidental send]

I believe that MLton will recognize that the loop function never returns 
normally, and so the non-tail call to loop can be turned into a tail call.
Looking at the 'max stack size' statistic shows that simple1 and simple2 
have the same max stack size (approx 24K with an input size of 750).




More information about the MLton mailing list