]> gitweb.factorcode.org Git - factor.git/blob - core/memory/memory-tests.factor
45e6090e773877981357c1bcae3ed312b3ab3ac3
[factor.git] / core / memory / memory-tests.factor
1 USING: generic kernel kernel.private math memory prettyprint io
2 sequences tools.test words namespaces layouts classes
3 classes.builtin arrays quotations io.launcher system ;
4 IN: memory.tests
5
6 [ ] [ { } { } become ] unit-test
7
8 ! LOL
9 [ ] [
10     vm
11     "-i=" image append
12     "-generations=2"
13     "-e=USING: memory io prettyprint system ; input-stream gc . 0 exit"
14     4array try-process
15 ] unit-test
16
17 [ [ ] instances ] must-infer
18
19 ! Code GC wasn't kicking in when needed
20 : leak-step ( -- ) 800000 f <array> 1quotation call( -- obj ) drop ;
21
22 : leak-loop ( -- ) 100 [ leak-step ] times ;
23
24 [ ] [ leak-loop ] unit-test
25
26 TUPLE: testing x y z ;
27
28 [ save-image-and-exit ] must-fail
29
30 ! Erg's bug
31 2 [ [ [ 3 throw ] instances ] must-fail ] times
32
33 ! Bug found on Windows build box, having too many words in the image breaks 'become'
34 [ ] [ 100000 [ f <uninterned-word> ] replicate { } { } become drop ] unit-test