From 0e79ff7a914bec53514177c6c821e30aaef1fae0 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Mon, 6 Jun 2011 08:06:58 -0700 Subject: [PATCH] Trigger-secondary-gc-daemons! every 100 GCs or so. --- src/gtk/thread.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gtk/thread.scm b/src/gtk/thread.scm index 69105932a..b492f7bc2 100644 --- a/src/gtk/thread.scm +++ b/src/gtk/thread.scm @@ -29,6 +29,9 @@ USA. (define gtk-thread #f) +;; Number of GCs between applications of trigger-secondary-gc-daemons! +(define secondary-gc-rate 100) + ;;; With the following thread always running, the runtime system ;;; should no longer use wait-for-io, nor need to signal ;;; condition-type:no-thread! @@ -44,7 +47,8 @@ USA. (create-thread #f (lambda () (let ((self (current-thread)) - (done-tick 0)) + (done-tick 0) + (next-secondary-tick secondary-gc-rate)) (let gtk-thread-loop () (without-interrupts (lambda () @@ -52,7 +56,12 @@ USA. (if (fix:< done-tick gc-tick) (begin (run-gc-cleanups) - (set! done-tick gc-tick)))))) + (set! done-tick gc-tick))) + (if (fix:< next-secondary-tick gc-tick) + (begin + (trigger-secondary-gc-daemons!) + (set! next-secondary-tick + (fix:+ gc-tick secondary-gc-rate))))))) (without-interrupts (lambda () (let ((time (if (thread/next self) -- 2.25.1