]> gitweb.factorcode.org Git - factor.git/blob - core/memory/memory-tests.factor
Merge branch 'master' into directory-searching
[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 [ ] [
31     num-types get [
32         type>class [
33             dup . flush
34             "predicate" word-prop instances [
35                 class drop
36             ] each
37         ] when*
38     ] each
39 ] unit-test
40
41 ! Erg's bug
42 2 [ [ [ 3 throw ] instances ] must-fail ] times