5 (setq *x
* (make-string 100000))))
7 ;; check that WITHOUT-INTERRUPTS doesn't block the gc trigger
8 (with-test (:name
:cons-madly-without-interrupts
)
9 (sb-sys:without-interrupts
(cons-madly)))
11 (with-test (:name
:without-gcing
)
12 (let ((gc-happend nil
))
13 (push (lambda () (setq gc-happend t
)) sb-ext
:*after-gc-hooks
*)
15 ;; check that WITHOUT-GCING defers explicit gc
18 (assert (not gc-happend
)))
21 ;; check that WITHOUT-GCING defers SIG_STOP_FOR_GC
23 (let ((in-without-gcing nil
))
25 (sb-thread:make-thread
(lambda ()
26 (loop while
(not in-without-gcing
))
29 (setq in-without-gcing t
)
31 (assert (not gc-happend
)))
32 ;; give the hook time to run
34 (assert gc-happend
))))
36 ;;; After each iteration of FOO there are a few pinned conses.
37 ;;; On alternate GC cycles, those get promoted to generation 1.
38 ;;; When the logic for page-spanning-object zeroing incorrectly decreased
39 ;;; the upper bound on bytes used for partially pinned pages, it caused
40 ;;; an accumulation of pages in generation 1 each with 2 objects' worth
41 ;;; of bytes, and the remainder waste. Because the waste was not accounted
42 ;;; for, it did not trigger GC enough to avoid heap exhaustion.
43 (with-test (:name
:smallobj-auto-gc-trigger
)
44 ;; Ensure that these are compiled functions because the interpreter
45 ;; would make lots of objects of various sizes which is insufficient
46 ;; to provoke the bug.
47 (setf (symbol-function 'foo
)
48 (compile nil
'(lambda () (list 1 2))))
49 ;; 500 million iterations of this loop seems to be reliable enough
50 ;; to show that GC happens.
51 (setf (symbol-function 'callfoo
)
52 (compile nil
'(lambda () (loop repeat
500000000 do
(foo)))))
56 (with-test (:name
:concurrently-alloc-code
)
57 ;; this debug setting may or may not find a problem, but it can't hurt to try
58 (setf (extern-alien "pre_verify_gen_0" int
) 1)
60 (sb-thread:make-thread
61 (let ((stop (+ (get-internal-real-time)
62 (* 1.5 internal-time-units-per-second
))))
64 (loop while
(<= (get-internal-real-time) stop
)
65 do
(compile nil
`(lambda () (print 20)))
70 (unless (sb-thread:thread-alive-p worker-th
)
72 (sb-unix:nanosleep
0 (+ 1000000 (random 100000))))
73 (let ((compiles (sb-thread:join-thread worker-th
)))
74 (format t
"~&Compiled ~D times, GC'ed ~D times~%"
76 (setf (extern-alien "pre_verify_gen_0" int
) 0))