1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-28 16:00:22 +02:00

Document the failure of `gc.test' wrt. unused modules.

* test-suite/tests/gc.test (Unused modules are removed): Use guardians
  instead of `gc-live-object-stats'.  Explain failure (FIXME).

* ice-9/boot-9.scm (make-module): Add `FIXME' about circular reference.

git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-9
This commit is contained in:
Ludovic Courtes 2007-10-21 18:53:50 +00:00 committed by Ludovic Courtès
parent 35747a3e06
commit 328efeb9a6
2 changed files with 15 additions and 9 deletions

View file

@ -1223,6 +1223,8 @@
;; We can't pass this as an argument to module-constructor,
;; because we need it to close over a pointer to the module
;; itself.
;; FIXME: This creates a circular reference between MODULE and its
;; standard eval closure which precludes them from being collected.
(set-module-eval-closure! module (standard-eval-closure module))
module))))

View file

@ -1,5 +1,5 @@
;;;; gc.test --- test guile's garbage collection -*- scheme -*-
;;;; Copyright (C) 2000, 2001, 2004, 2006 Free Software Foundation, Inc.
;;;; Copyright (C) 2000, 2001, 2004, 2006, 2007 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -59,13 +59,17 @@
(with-test-prefix "gc"
(pass-if "Unused modules are removed"
(let*
((dummy (gc))
(last-count (cdr (assoc
"eval-closure" (gc-live-object-stats)))))
(for-each (lambda (x) (make-module)) (iota 1000))
;; FIXME: This test fails because of the circular reference
;; created by `make-module' between the module itself and its
;; standard eval closure.
(let* ((guard (make-guardian))
(total 1000))
(for-each (lambda (x) (guard (make-module))) (iota total))
(gc)
(gc) ;; twice: have to kill the weak vectors.
(= last-count (cdr (assoc "eval-closure" (gc-live-object-stats)))))
))
(= (length (filter (lambda (x)
(eq? x #t))
(map (lambda (x) (and (guard) #t))
(iota total))))
total))))