You can call make-module (from boot-9.scm) as much as you want to create empty 
modules.
Memory won't leak.

As soon as you call eval with that module, it seems it can't be garbage 
collected anymore.

This bug also appears as part of the (@ (rnrs eval) environment) procedure 
because it uses both of those.

Try it out:
(format #t "kb: ~a\n" (floor (/ (assoc-ref (gc-stats) 'heap-size) 1024)))
(let lp ((x 0))
  (unless (eqv? x 50000)
    (let ((m (make-module)))
      (eval '1 m) ;; comment this line to remove memory leak
      2)
    (lp (1+ x))))
(gc)
(format #t "kb: ~a\n" (floor (/ (assoc-ref (gc-stats) 'heap-size) 1024)))



Reply via email to