[racket] Liveliness of variables and GC

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Oct 26 12:38:43 EDT 2011

At Wed, 26 Oct 2011 17:27:02 +0100, "nicolas.oury at gmail.com" wrote:
> 1)
> (define (f x y)
>     (lambda () x))
> (define g (f 2 veryBigObject) )
> 
> Can I be sure that g does not retain a pointer to veryBigObject?

Yes.

> 2) (g is a function)
> 
> (define (f)
>    (let ([x veryBigObject])
>       (g)))
> 
> Can I be sure that veryBigObject is not retained by f during the execution
> of g?

Yes.

> 3) Same program.
> g now captures its continuation. Can I be sure that this continuation does
> not retain veryBigObject?

Yes.



Posted on the users mailing list.