am 07837862: Merge "Fine tune the high memory threshold and usage delta for v8 GC." into honeycomb

* commit '078378624c1955a1e842af34f79798918edccc21':
  Fine tune the high memory threshold and usage delta for v8 GC.
This commit is contained in:
Shimeng (Simon) Wang
2011-01-26 13:25:50 -08:00
committed by Android Git Automerger

View File

@@ -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(