* tests/gc/ThreadStress.java: Added stress test for threads.
authormichi <none@none>
Thu, 29 Mar 2007 16:44:06 +0000 (16:44 +0000)
committermichi <none@none>
Thu, 29 Mar 2007 16:44:06 +0000 (16:44 +0000)
--HG--
branch : exact-gc

tests/gc/ThreadStress.java [new file with mode: 0644]

diff --git a/tests/gc/ThreadStress.java b/tests/gc/ThreadStress.java
new file mode 100644 (file)
index 0000000..c88de53
--- /dev/null
@@ -0,0 +1,21 @@
+public class ThreadStress extends Thread {
+       public static final int N=10;
+
+       public void run() {
+               while (true) {
+                       System.gc();
+               }
+       }
+
+       public static void main(String args[]) {
+               ThreadStress t = null;
+
+               System.out.println("Creating and starting threads ...");
+               for (int i=0; i<N; i++) {
+                       t = new ThreadStress();
+                       t.start();
+               }
+
+               System.out.println("Finished.");
+       }
+}