I'm seeing a difference between when the value in a weak box is collected. When I run the following interactively, the value is collected like I expect. But it is not collected when running in a script, or in DrRacket. This is v5.1 on Ubuntu x64, compiled from source.

Can someone explain the difference?

~$ racket
Welcome to Racket v5.1.
> (define b (make-weak-box 'not-used))
> (weak-box-value b)
'not-used
> (collect-garbage)
> (weak-box-value b)
#f


~$ cat weak-box.rkt
#lang racket

(define b (make-weak-box 'not-used))
(weak-box-value b)
(collect-garbage)
(weak-box-value b)

~$ racket weak-box.rkt
'not-used
'not-used

Thanks,
Dave
_________________________________________________
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/dev

Reply via email to