diff options
author | Narayan Kamath <narayan@google.com> | 2014-10-03 10:28:06 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2014-10-03 10:28:06 +0100 |
commit | d3b74a8affe39699df64469c955d0e925e1566fb (patch) | |
tree | 18759aecaaba0dc4978e0921016f0c0a5d67370c | |
parent | f8638c30c92778d307d056fa61448584141c3f05 (diff) | |
download | libcore-d3b74a8affe39699df64469c955d0e925e1566fb.zip libcore-d3b74a8affe39699df64469c955d0e925e1566fb.tar.gz libcore-d3b74a8affe39699df64469c955d0e925e1566fb.tar.bz2 |
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
-rw-r--r-- | harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/RuntimeTest.java | 26 |
1 files changed, 0 insertions, 26 deletions
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 @@ public class RuntimeTest extends junit.framework.TestCase { } /** - * 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() { |