[plt-scheme] call/cc and memory consumption

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Jun 20 08:49:18 EDT 2005

> From: Matthias Felleisen [mailto:matthias at ccs.neu.edu]
> Sent: Wed 6/15/2005 2:18 PM
> To: David Van Horn
> Cc: Duba, Bruce; PLT Scheme List
> Subject: Re: [plt-scheme] call/cc and space
>
>
>
> On Jun 15, 2005, at 4:44 PM, David Van Horn wrote:
>
> >  For list-related administrative tasks:
>http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >
> > The recent mention of space safety made me revisit R5RS.  Is my
> > understanding correct in that the following should use a bounded
> > amount of memory?
> >
> > (let loop () (call/cc (lambda (k) (loop))))
> >
> > R5RS requires call/cc to apply it's argument in a tail position, and
> > the call to loop is in a tail position within that procedure.
>
> Sure, the _control_ space should not grow at all. But that doesn't mean
> that space consumption shouldn't grow. Consider
>
>   (let loop ([n LARGE-NUMBER]) (loop (* LARGE-NUMBER LARGE-NUMBER)))
>
> Clearly, space consumption will grow but control space consumption
> won't.
>
> > The callcc example grows in MzScheme, although not in Petite Chez.
>
> And that explains that. -- Matthias
>
> P.S. Until you can show that control space consumption grows in
> MzScheme.


David, I was wrong; your loop doesn't hang on to non-control memory. 
Sorry. But mzscheme's memory consumption stabilizes for the above tight 
loop after a couple of rounds so I am not sure how the problem could 
show up. -- Matthias



Posted on the users mailing list.