From ef294e47b423d342f4d915392912d291ec997503 Mon Sep 17 00:00:00 2001
From: Matthew Flatt <mflatt@racket-lang.org>
Date: Tue, 27 May 2008 17:20:24 +0000
Subject: [PATCH] add and use close-eval to reduce memory use when rendering
 reference and guide

svn: r9981

original commit: 7ae0f500ae236de71c68feec7ea727818a3b6220
---
 collects/scribble/eval.ss                | 5 +++++
 collects/scribblings/scribble/eval.scrbl | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/collects/scribble/eval.ss b/collects/scribble/eval.ss
index 765793bb..309764eb 100644
--- a/collects/scribble/eval.ss
+++ b/collects/scribble/eval.ss
@@ -23,6 +23,7 @@
            as-examples
            
            make-base-eval
+           close-eval
 
            scribble-eval-handler)
 
@@ -244,6 +245,10 @@
                    [sandbox-eval-limits #f]
                    [sandbox-make-inspector current-inspector])
       (make-evaluator '(begin (require scheme/base)))))
+
+  (define (close-eval e)
+    (kill-evaluator e)
+    "")
       
   (define (do-plain-eval ev s catching-exns?)
     (call-with-values (lambda () 
diff --git a/collects/scribblings/scribble/eval.scrbl b/collects/scribblings/scribble/eval.scrbl
index e6b4df83..31231965 100644
--- a/collects/scribblings/scribble/eval.scrbl
+++ b/collects/scribblings/scribble/eval.scrbl
@@ -93,6 +93,13 @@ setting sandbox parameters to disable limits, set the outputs to
 @scheme['string], and not add extra security guards.}
 
 
+@defproc[(close-eval [eval (any/c . -> . any)]) (one-of/c "")]{
+
+Shuts down an evaluator produced by @scheme[make-base-eval]. Use
+@scheme[close-eval] when garbage collection cannot otherwise reclaim
+an evaluator (e.g., because it is defined in a module body).}
+
+
 @defparam[scribble-eval-handler handler 
           ((any/c . -> . any) any/c boolean? . -> . any)]{