diff options
| author | 2014-01-16 23:15:17 +0000 | |
|---|---|---|
| committer | 2014-01-16 23:15:17 +0000 | |
| commit | a17059b78795e095c75a3d31ce8553e8713900c8 (patch) | |
| tree | a329365a16dc1287676f8784333ae43d62e49ab0 | |
| parent | fed65a6b4a0c601defb0884df50e92c6d40fe42f (diff) | |
| parent | 6f3a38f3afd79ed6dddcef5c83cb442d6749e2ff (diff) | |
Merge "Run finalizers before counting for StrictMode."
| -rw-r--r-- | core/java/android/os/StrictMode.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java index d794ca674d49..ea71ad8c0563 100644 --- a/core/java/android/os/StrictMode.java +++ b/core/java/android/os/StrictMode.java @@ -1449,7 +1449,11 @@ public final class StrictMode { if (policy.classInstanceLimit.size() == 0) { return; } - Runtime.getRuntime().gc(); + + System.gc(); + System.runFinalization(); + System.gc(); + // Note: classInstanceLimit is immutable, so this is lock-free for (Map.Entry<Class, Integer> entry : policy.classInstanceLimit.entrySet()) { Class klass = entry.getKey(); @@ -2005,7 +2009,10 @@ public final class StrictMode { // noticeably less responsive during orientation changes when activities are // being restarted. Granted, it is only a problem when StrictMode is enabled // but it is annoying. - Runtime.getRuntime().gc(); + + System.gc(); + System.runFinalization(); + System.gc(); long instances = VMDebug.countInstancesOfClass(klass, false); if (instances > limit) { |