Delete RuntimeTest.test_gc.
This test is flaky (see below), and it's not testing anything useful.
- the value returned by totalMemory() can increase if the heap expands
- similar issue with freeMemory(), which is only measured against the
current heap size
- the test assumes that there aren't any other threads in the process
allocating objects.
bug: 17663212
Change-Id: I43fb4c2d4412033cd01bb3a533a34e47905ff229
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/RuntimeTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/RuntimeTest.java
index a41efb3..11b7769 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/RuntimeTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/RuntimeTest.java
@@ -84,32 +84,6 @@
}
/**
- * java.lang.Runtime#gc()
- */
- public void test_gc() {
- // Test for method void java.lang.Runtime.gc()
- try {
- r.gc(); // ensure all garbage objects have been collected
- r.gc(); // two GCs force collection phase to complete
- long firstRead = r.totalMemory() - r.freeMemory();
- Vector<StringBuffer> v = new Vector<StringBuffer>();
- for (int i = 1; i < 10; i++)
- v.addElement(new StringBuffer(10000));
- long secondRead = r.totalMemory() - r.freeMemory();
- v = null;
- r.gc();
- r.gc();
- assertTrue("object memory did not grow", secondRead > firstRead);
- assertTrue("space was not reclaimed", (r.totalMemory() - r
- .freeMemory()) < secondRead);
- } catch (OutOfMemoryError oome) {
- System.out.println("Out of memory during freeMemory test");
- r.gc();
- r.gc();
- }
- }
-
- /**
* java.lang.Runtime#getRuntime()
*/
public void test_getRuntime() {