From 898c92c45c812861f9e309ae1a5b5b3e7c33c01b Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Wed, 1 Sep 2010 16:57:12 +0000 Subject: [PATCH] 1.0.42.19: make SB-CONCURRENCY more GC friendly * Patch by "3b", lp#628098. * Break chains of detached nodes, so conservativism won't kill us. --- contrib/sb-concurrency/queue.lisp | 18 +++++++++++++----- version.lisp-expr | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/contrib/sb-concurrency/queue.lisp b/contrib/sb-concurrency/queue.lisp index a902785..5fa7007 100644 --- a/contrib/sb-concurrency/queue.lisp +++ b/contrib/sb-concurrency/queue.lisp @@ -80,11 +80,19 @@ and secondary value." (go :continue))) (when (eq head (sb-ext:compare-and-swap (queue-head queue) head first-node-prev)) - ;; This assignment is not present in the paper, but is - ;; equivalent to the free(head.ptr) call there: it unlinks - ;; the HEAD from the queue -- the code in the paper leaves - ;; the dangling pointer in place. - (setf (node-next first-node-prev) nil) + ;; These assignment is not present in the paper, but are + ;; equivalent to the free(head.ptr) call there. + ;; + ;; First we unlink the HEAD from the queue -- the code in + ;; the paper leaves the dangling pointer in place. + ;; + ;; Then we NIL out the slots in HEAD to help the GC, + ;; otherwise conservativism might lead to massive chains of + ;; nodes being retained. + (setf (node-next first-node-prev) nil + (node-prev head) nil + (node-next head) nil + (node-value head) nil) (return-from dequeue (values val t)))) ((eq tail head) (return-from dequeue (values nil nil))) diff --git a/version.lisp-expr b/version.lisp-expr index 52b3a7d..7a89c31 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.42.18" +"1.0.42.19" -- 1.7.10.4