[plt-scheme] call/cc and space

From: John Clements (clements at brinckerhoff.org)
Date: Tue Feb 7 19:01:27 EST 2006

On Feb 7, 2006, at 3:31 PM, Robby Findler wrote:

> I spoke too broadly. I should have said that what I consider the
> interesting cases of safe fon r space has nothing to do with GC. (Your
> original message asserted that safe for space was entirely about GC,
> IIUC.) Those cases are about stack management, not heap management
> (and, as Matthias points out, you might call pop() gc). Sorry for the
> confusion.
>
> Anyways, the expensive/interesting problem, as I understand it, is  
> that
> when you enter a let (say), you hold on to the bindings in the let  
> even
> if the variable bound in the let is not free in the term you're  
> working
> on. For example, in mzscheme, this prints #t (followed by #f), but  
> in a
> safe for space implementation, it would print #f (followed by #f).
>
> (require (lib "etc.ss"))
>
> (define tmp #f)
>
> (let ([x (build-list 10000 add1)])
>   (set! tmp (make-weak-box x))
>   (collect-garbage) ;; a bunch to make sure
>   (collect-garbage) ;; nothing fishy with
>   (collect-garbage) ;; finalizers or conservative
>   (collect-garbage) ;; collection is going on.
>   (printf "~s\n" (pair? (weak-box-value tmp))))
>
> (collect-garbage)
> (printf "~s\n" (pair? (weak-box-value tmp)))

Yeap, I agree.

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2430 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20060207/2b088472/attachment.p7s>

Posted on the users mailing list.