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)
> (collect-garbage)
> (weak-box-value b)

~$ cat weak-box.rkt
#lang racket

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

~$ racket weak-box.rkt

 For list-related administrative tasks:

Reply via email to