diff options
author | Ludovic Courtes <ludo@gnu.org> | 2007-10-21 18:53:50 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2008-09-10 22:52:21 +0200 |
commit | 328efeb9a66dddcf78a24fad96d3db58e9c3375d (patch) | |
tree | 6db8a21ac26fcff5f34cb1062348aa5a4e73f672 | |
parent | 35747a3e063ae0dd2e8828c680a76e8589d7b8c7 (diff) | |
download | guile-328efeb9a66dddcf78a24fad96d3db58e9c3375d.tar.gz |
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
-rw-r--r-- | ice-9/boot-9.scm | 2 | ||||
-rw-r--r-- | test-suite/tests/gc.test | 22 |
2 files changed, 15 insertions, 9 deletions
diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm index 6ada33c68..5a74f945f 100644 --- a/ice-9/boot-9.scm +++ b/ice-9/boot-9.scm @@ -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)))) diff --git a/test-suite/tests/gc.test b/test-suite/tests/gc.test index abd714b9a..d881aba17 100644 --- a/test-suite/tests/gc.test +++ b/test-suite/tests/gc.test @@ -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)))) |