[racket] Namespaces - GCable?
Sure, they are collected. This returns #f when I run it for the last result.
#lang racket
(define TMP (make-base-namespace))
(define wb (make-weak-box TMP))
(parameterize ([current-namespace TMP])
(namespace-require 'racket)
(eval '(length (list 1 2 3))))
(set! TMP #f)
(collect-garbage)
(weak-box-value wb)
On Sat, Feb 9, 2013 at 6:50 PM, Ray Racine <ray.racine at gmail.com> wrote:
> The API is pretty flexible about creating and loading modules into
> namespaces. What is not apparent is how to evict a namespace or the
> GC-ableness of a namespace.
>
> In the REPL, topleve.
>
> Say I in a scope of code, I create a base namespace I'll call TMP, load or
> attach modules into it, switch to it via current-namespace.
>
> Now say I switch the current-namespace to some other namespace, maybe the
> original I saved before I created TMP. At the top-level, to me, there is
> no reference to TMP. Will TMP be GC'd? Or is there away to explicitly
> "purge" an unused namespace?
>
> Thanks,
>
> Ray
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130209/bc5ebaaf/attachment.html>