[MLton] callcc and space use

Daniel Spoonhower spoons at cs.cmu.edu
Wed Jan 23 09:29:05 PST 2008


Vesa Karvonen wrote:
 > On Jan 23, 2008 3:03 PM, Daniel Spoonhower <spoons at cs.cmu.edu> wrote:
 > [...]
 >> I attached a small(-ish) example.  It copies and reverses a list of
 >> reals.  Toward the end of execution there are more than 4000 live cons
 >> cells in the heap, though the length of the input list is only 75.
 >
 > BTW, how did you get the numbers?

I just added a few lines to the collector to count how many objects of 
each object type were found.  There was only one object type that looked 
like a list of reals.

 > 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.

--djs

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://mlton.org/pipermail/mlton/attachments/20080123/b22d8f04/signature.pgp


More information about the MLton mailing list