1.0.26.21: fix ERROR leaking memory
authorGabor Melis <mega@hotpop.com>
Tue, 24 Mar 2009 14:44:09 +0000 (14:44 +0000)
committerGabor Melis <mega@hotpop.com>
Tue, 24 Mar 2009 14:44:09 +0000 (14:44 +0000)
Make *COMPILED-DEBUG-FUNS* a weak keyed hash table. Add test.

NEWS
src/code/debug-int.lisp
tests/compiler.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index a5c7252..2242954 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ changes in sbcl-1.0.27 relative to 1.0.26:
     1.0.25.37, reported by Harald Hanche-Olsen)
   * bug fix: work around signal delivery bug in darwin (regression from
     1.0.25.44, reported by Sidney Markowitz)
+  * bug fix: fix ERROR leaking memory (reported by David Thompson)
 
 changes in sbcl-1.0.26 relative to 1.0.25:
   * incompatible change: an interruption (be it a function passed to
index 57fe61d..e5dfe62 100644 (file)
 ;;; This maps SB!C::COMPILED-DEBUG-FUNs to
 ;;; COMPILED-DEBUG-FUNs, so we can get at cached stuff and not
 ;;; duplicate COMPILED-DEBUG-FUN structures.
-(defvar *compiled-debug-funs* (make-hash-table :test 'eq))
+(defvar *compiled-debug-funs* (make-hash-table :test 'eq :weakness :key))
 
 ;;; Make a COMPILED-DEBUG-FUN for a SB!C::COMPILER-DEBUG-FUN and its
 ;;; component. This maps the latter to the former in
index c15216a..87c2265 100644 (file)
              (assert (eq :two (type-error-datum e)))
              (assert (eq 'number (type-error-expected-type e)))
              :error))))))
+
+(with-test (:name :compiled-debug-funs-leak)
+  (sb-ext:gc :full t)
+  (let ((usage-before (sb-kernel::dynamic-usage)))
+    (dotimes (x 10000)
+      (let ((f (compile nil '(lambda ()
+                               (error "X")))))
+        (handler-case
+            (funcall f)
+          (error () nil))))
+    (sb-ext:gc :full t)
+    (let ((usage-after (sb-kernel::dynamic-usage)))
+      (when (< (+ usage-before 2000000) usage-after)
+        (error "Leak")))))
 \f
 ;;;; tests not in the problem domain, but of the consistency of the
 ;;;; compiler machinery itself
index 352ec8a..bd81948 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.26.20"
+"1.0.26.21"