diff options
Diffstat (limited to 'test/096-array-copy-concurrent-gc/src/Main.java')
-rw-r--r-- | test/096-array-copy-concurrent-gc/src/Main.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/test/096-array-copy-concurrent-gc/src/Main.java b/test/096-array-copy-concurrent-gc/src/Main.java index 3cf791a555..eddde11b44 100644 --- a/test/096-array-copy-concurrent-gc/src/Main.java +++ b/test/096-array-copy-concurrent-gc/src/Main.java @@ -44,6 +44,15 @@ public class Main { Object [] array = new Object[8000]; + void allocateFourStrings() { + for (int i = 0; i < 4; i++) { + String str = new String("Creating some garbage" + Math.random()); + if (str.length() < 22) { + System.out.println("bad length"); + } + } + } + void stressArray(boolean doLog) { // We want many references in the array // We also want elements close to each other to have large @@ -63,20 +72,14 @@ public class Main { Object obj = array[array.length - 1]; System.arraycopy(array, 0, array, 1, array.length - 1); array[0] = obj; - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); + allocateFourStrings(); } for (int j = 0; j < array.length; j++) { Object obj = array[0]; System.arraycopy(array, 1, array, 0, array.length - 1); array[array.length - 1] = obj; - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); + allocateFourStrings(); } if (doLog) { |