1 USING: accessors kernel kernel.private math memory prettyprint
2 io sequences tools.test words namespaces layouts classes
3 classes.builtin arrays quotations system ;
4 FROM: tools.memory => data-room code-room ;
7 [ save-image-and-exit ] must-fail
9 ! Tests for 'instances'
10 [ [ ] instances ] must-infer
11 2 [ [ [ 3 throw ] instances ] must-fail ] times
14 [ ] [ { } { } become ] unit-test
16 ! Bug found on Windows build box, having too many words in the
17 ! image breaks 'become'
18 [ ] [ 100000 [ f <uninterned-word> ] replicate { } { } become drop ] unit-test
20 ! Bug: code heap collection had to be done when data heap was
21 ! full, not just when code heap was full. If the code heap
22 ! contained dead code blocks referring to large data heap
23 ! objects, those large objects would continue to live on even
24 ! if the code blocks were not reachable, as long as the code
25 ! heap did not fill up.
26 : leak-step ( -- ) 800000 f <array> 1quotation call( -- obj ) drop ;
28 : leak-loop ( -- ) 100 [ leak-step ] times ;
30 [ ] [ leak-loop ] unit-test
32 ! Bug: allocation of large objects directly into tenured space
33 ! can proceed past the high water mark.
35 ! Suppose the nursery and aging spaces are mostly comprised of
36 ! reachable objects. When doing a full GC, objects from young
37 ! generations ere promoted *before* unreachable objects in
38 ! tenured space are freed by the sweep phase. So if large object
39 ! allocation filled up the heap past the high water mark, this
40 ! promotion might trigger heap growth, even if most of those
41 ! large objects are unreachable.
47 data-room tenured>> size>>
50 4 [ 120 1024 * f <array> ] replicate foo set-global
51 100 [ 256 1024 * f <array> drop ] times
54 data-room tenured>> size>>