GNU bug report logs - #77374
eval causes temporary modules to leak memory

Previous Next

Package: guile;

Reported by: nathan <nathan_mail <at> nborghese.com>

Date: Sun, 30 Mar 2025 01:10:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: nathan <nathan_mail <at> nborghese.com>
To: 77374 <at> debbugs.gnu.org
Subject: bug#77374: eval causes temporary modules to leak memory
Date: Sun, 30 Mar 2025 01:08:51 +0000
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)))




This bug report was last modified 82 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.