From 9abfd1a2b22862570c15ffa5129b1196d0480290 Mon Sep 17 00:00:00 2001 From: Gabor Melis Date: Tue, 24 Mar 2009 14:44:09 +0000 Subject: [PATCH] 1.0.26.21: fix ERROR leaking memory Make *COMPILED-DEBUG-FUNS* a weak keyed hash table. Add test. --- NEWS | 1 + src/code/debug-int.lisp | 2 +- tests/compiler.impure.lisp | 14 ++++++++++++++ version.lisp-expr | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index a5c7252..2242954 100644 --- 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 diff --git a/src/code/debug-int.lisp b/src/code/debug-int.lisp index 57fe61d..e5dfe62 100644 --- a/src/code/debug-int.lisp +++ b/src/code/debug-int.lisp @@ -298,7 +298,7 @@ ;;; 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 diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index c15216a..87c2265 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -1055,6 +1055,20 @@ (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"))))) ;;;; tests not in the problem domain, but of the consistency of the ;;;; compiler machinery itself diff --git a/version.lisp-expr b/version.lisp-expr index 352ec8a..bd81948 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4