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

Commit 7114f3bf authored by Shimeng (Simon) Wang's avatar Shimeng (Simon) Wang
Browse files

Fine tune the high memory threshold and usage delta for v8 GC.

This will help reduce a bit more v8 GC for heavy web sites.

issue: 3317574
Change-Id: I5f93f9311fc864fb13933f92ff402e00c0e6fcdf
parent 3115dad3
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -188,14 +188,9 @@ final class WebViewCore {
        // Allow us to use up to our memory class value before V8's GC kicks in.
        // These values have been determined by experimentation.
        mLowMemoryUsageThresholdMb = manager.getLargeMemoryClass();
        // If things get crazy, allow V8 to use up to 3 times our memory class, or a third of the
        // device's total available memory, whichever is smaller.  This value must be no less
        // than the low memory threshold.
        // At that point V8 will start attempting more aggressive garbage collection.
        mHighMemoryUsageThresholdMb = Math.max(Math.min(mLowMemoryUsageThresholdMb * 3,
                (int) (memInfo.availMem / 3) >> 20), mLowMemoryUsageThresholdMb);
        mHighMemoryUsageThresholdMb = (int) (mLowMemoryUsageThresholdMb * 1.5);
        // Avoid constant V8 GC when memory usage equals to working set estimate.
        mHighUsageDeltaMb = 1;
        mHighUsageDeltaMb = mLowMemoryUsageThresholdMb / 32;

        // Send a message to initialize the WebViewCore.
        Message init = sWebCoreHandler.obtainMessage(