Question

"scribble" is the racket documentation tool. I have got a problem with the following example. When N=30, scribble uses ~500M memory. It seems very difficult to have more than 300 such examples in a single scribble document.

cat <<EOF
#lang scribble/manual
@(require scribble/eval)

@title["hello world"]   
EOF
N=30
for((i=0;i<N;i++));do
    cat <<EOF
@(examples
       (require racket/snip)
         (require racket/class)
       (make-object image-snip% "a.jpg"))

EOF
done
) > x.scrbl
scribble x.scrbl 
Was it helpful?

Solution

I think examples creates a new evaluator each time, which is rather expensive. If possible, create a single evaluator for your entire document:

#lang scribble/manual
@(require scribble/eval)
@(define the-eval (make-base-eval))

@examples[#:eval the-eval
(require racket/snip)
(require racket/class)
(make-object image-snip% "a.jpg")
]
...
@examples[#:eval the-eval
<more stuff>
]

That should use significantly less memory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top