Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a17059b7 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Run finalizers before counting for StrictMode."

parents fed65a6b 6f3a38f3
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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) {