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

Commit 3796594c authored by Mark Renouf's avatar Mark Renouf Committed by Android Git Automerger
Browse files

am a63cd9f4: Merge "Run finalizers before counting for StrictMode." into klp-modular-dev

* commit 'a63cd9f4':
  Run finalizers before counting for StrictMode.
parents b98ee1eb a63cd9f4
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) {