]> gitweb.factorcode.org Git - factor.git/blobdiff - core/memory/memory-tests.factor
compiler.cfg.*: a bunch of new tests
[factor.git] / core / memory / memory-tests.factor
index c7ec6ee8d6957ef5f89d252d5292807785f6e348..8b5360f3cfaa000636b9943d6897d39befd66b55 100644 (file)
@@ -1,4 +1,4 @@
-USING: accessors kernel kernel.private math memory prettyprint
+USING: accessors effects kernel kernel.private math memory prettyprint
 io sequences tools.test words namespaces layouts classes
 classes.builtin arrays quotations system ;
 FROM: tools.memory => data-room code-room ;
@@ -73,3 +73,21 @@ SYMBOL: foo
     data-room tenured>> size>>
     assert=
 ] unit-test
+
+! Perform one gc cycle. Then increase the stack height by 100 and
+! force a gc cycle again.
+SYMBOL: foo-var
+
+: perform ( -- )
+    { 1 2 3 } { 4 5 6 } <effect> drop ;
+
+: deep-stack-minor-gc ( n -- )
+    dup [
+        dup 0 > [ 1 - deep-stack-minor-gc ] [
+            drop 100000 [ perform ] times
+        ] if
+    ] dip foo-var set ;
+
+{ } [
+    minor-gc 100 deep-stack-minor-gc
+] unit-test