diff options
author | Neil Fuller <nfuller@google.com> | 2014-03-03 11:33:09 +0000 |
---|---|---|
committer | Neil Fuller <nfuller@google.com> | 2014-03-03 13:27:00 +0000 |
commit | 9c46602b63ac350c081bcb9aaef8260673d2ac73 (patch) | |
tree | a3f79de8b1c403b8d6b4ed8f6733f02856059a98 /support | |
parent | 4189a6e183e8c38992df6de29321733fad06e50a (diff) | |
download | libcore-9c46602b63ac350c081bcb9aaef8260673d2ac73.zip libcore-9c46602b63ac350c081bcb9aaef8260673d2ac73.tar.gz libcore-9c46602b63ac350c081bcb9aaef8260673d2ac73.tar.bz2 |
Modify FinalizationTester to use Runtime.gc()
System.gc() has changed in Android: it doesn't gc every time
any more. Runtime.getRuntime().gc() is more likely to cause
a garbage collection.
Change-Id: I294c98a3b82ccb8867b6667d35c88fe9441110db
Bug: 13097524
Diffstat (limited to 'support')
-rw-r--r-- | support/src/test/java/libcore/java/lang/ref/FinalizationTester.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/support/src/test/java/libcore/java/lang/ref/FinalizationTester.java b/support/src/test/java/libcore/java/lang/ref/FinalizationTester.java index 66ac1a4..d758317 100644 --- a/support/src/test/java/libcore/java/lang/ref/FinalizationTester.java +++ b/support/src/test/java/libcore/java/lang/ref/FinalizationTester.java @@ -26,7 +26,9 @@ public final class FinalizationTester { private FinalizationTester() {} public static void induceFinalization() { - System.gc(); + // System.gc() does not garbage collect every time. Runtime.gc() is + // more likely to perfom a gc. + Runtime.getRuntime().gc(); enqueueReferences(); System.runFinalization(); } |