diff --git a/pkgs/racket-test-core/tests/racket/will.rktl b/pkgs/racket-test-core/tests/racket/will.rktl index 801acba0e7..1250b290ac 100644 --- a/pkgs/racket-test-core/tests/racket/will.rktl +++ b/pkgs/racket-test-core/tests/racket/will.rktl @@ -247,6 +247,10 @@ (unless (eq? 'cgc (system-type 'gc)) (define s (make-semaphore)) (define c (make-custodian)) + (define bits (let loop ([bits 29]) + (if (fixnum? (expt 2 bits)) + bits + (loop (sub1 bits))))) (define t (parameterize ([current-custodian c]) (thread (lambda () (semaphore-wait s) diff --git a/racket/src/cs/rumble/memory.ss b/racket/src/cs/rumble/memory.ss index 1bf82626fd..19b43a1c8d 100644 --- a/racket/src/cs/rumble/memory.ss +++ b/racket/src/cs/rumble/memory.ss @@ -123,7 +123,7 @@ ;; `post-allocated+overhead` seems to be too long a wait, because ;; that value may include underused pages that have locked objects. ;; Using just `post-allocated` is too small, because it may force an - ;; immediate major GC too soon. Split the difference. + ;; immediate major GC too soon. Split the difference. (set! trigger-major-gc-allocated (* GC-TRIGGER-FACTOR (- post-allocated (bytes-finalized)))) (set! trigger-major-gc-allocated+overhead (* GC-TRIGGER-FACTOR post-allocated+overhead))) (update-eq-hash-code-table-size!) @@ -490,6 +490,7 @@ (define/who (make-phantom-bytes k) (check who exact-nonnegative-integer? k) + (guard-large-allocation who "byte string" k 1) (let ([ph (create-phantom-bytes (make-phantom-bytevector k))]) (when (or (>= (bytes-allocated) trigger-major-gc-allocated) (>= (current-memory-bytes) trigger-major-gc-allocated+overhead)) @@ -499,6 +500,8 @@ (define/who (set-phantom-bytes! phantom-bstr k) (check who phantom-bytes? phantom-bstr) (check who exact-nonnegative-integer? k) + (when (> k (phantom-bytevector-length (phantom-bytes-pbv phantom-bstr))) + (guard-large-allocation who "byte string" k 1)) (set-phantom-bytevector-length! (phantom-bytes-pbv phantom-bstr) k)) ;; ----------------------------------------