cs: scale GC trigger by number of running places

Since all places share the same pool of memory, scale the
amount of memory allowed before trigger a (minor) GC by
the number of running processes.
This commit is contained in:
Matthew Flatt 2020-08-15 19:29:32 -06:00
parent e47260cb36
commit f42ddd2853
2 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,12 @@
(define (set-reachable-size-increments-callback! proc)
(set! reachable-size-increments-callback proc))
(define allocating-places 1)
(define (collect-trip-for-allocating-places! delta)
(with-global-lock
(set! allocating-places (+ allocating-places delta))
(collect-trip-bytes (* allocating-places (* 8 1024 1024)))))
;; Replicate the counting that `(collect)` would do
;; so that we can report a generation to the notification
;; callback

View File

@ -81,6 +81,7 @@
(define (fork-place thunk finish-proc)
(do-prepare-for-place)
(fork-thread (lambda ()
(collect-trip-for-allocating-places! +1)
(init-virtual-registers)
(place-registers (vector-copy place-register-inits))
(root-thread-cell-values (make-empty-thread-cell-values))
@ -93,6 +94,7 @@
(thunk)
0))])
(finish-proc result)
(collect-trip-for-allocating-places! -1)
(do-destroy-place)))))
;; Must be called within an engine, used for memory accounting:
(define (current-place-roots)