SnapshotRestartTests: do a compressing GC after some iterations jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 27 Feb 2017 15:13:02 +0000
branchjv
changeset 1598 300cd20b8c03
parent 1597 44192c225011
child 1599 ad563876d688
SnapshotRestartTests: do a compressing GC after some iterations ...when used oldspace exeeds currently used space + 128MB. This has two reasons: * it stresses oldspace compatcion algorithm * it keeps the memory usage low so test won't run out of memory on low-memory hosts (low means < 1GB these days, funny isn't it?)
RegressionTests__VMCrashTests.st
--- a/RegressionTests__VMCrashTests.st	Mon Feb 27 10:11:32 2017 +0000
+++ b/RegressionTests__VMCrashTests.st	Mon Feb 27 15:13:02 2017 +0000
@@ -41,7 +41,7 @@
     <spawn: true>
     <timeout: 660> "11min"
 
-    | timeout deadline iterStart iterStop directory files i |   
+    | timeout deadline iterStart iterStop directory files oldSpaceSizeLimit i |   
 
     "/ See https://swing.fit.cvut.cz/projects/stx-jv/ticket/64
     self skipIf: OperatingSystem isMSWINDOWSlike description: 'Temporarily skipped because of issue #64'.
@@ -52,6 +52,9 @@
     iterStart := iterStop := 0.
     i := 0.
     directory := Smalltalk getPackageDirectoryForPackage: #'stx:goodies'.  
+
+    oldSpaceSizeLimit := ObjectMemory oldSpaceUsed + (128"MB"*1024*1024).
+
     [ OperatingSystem getMillisecondTime < (deadline - (iterStop - iterStart)) ] whileTrue:[
         iterStart := OperatingSystem getMillisecondTime.
 
@@ -61,11 +64,18 @@
         files := files select: [ :e | e suffix = 'st' ].
         files collect:[ :e | (FileStream fileNamed: e) contents asString ].   
         Stdout nextPutLine: 'Pass '  , i printString , '...OK'.
-
+        (oldSpaceSizeLimit notNil and:[ ObjectMemory oldSpaceUsed > oldSpaceSizeLimit ]) ifTrue:[ 
+            Stdout nextPutLine: 'GC'.
+            files := nil.
+            ObjectMemory compressingGarbageCollect.
+            oldSpaceSizeLimit := ObjectMemory oldSpaceUsed + (128"MB"*1024*1024).
+            Stdout nextPutLine: 'GC...OK '.
+        ].
         iterStop := OperatingSystem getMillisecondTime.
     ].
 
     "Created: / 04-09-2016 / 03:16:19 / jv"
+    "Modified: / 27-02-2017 / 12:10:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 test_java_initialize