Commit ff338c13 authored by Eric Karl's avatar Eric Karl Committed by Commit Bot

Fix memory limit computation for low-end Android

|dalvik_mb| no longer follows the expected heuristic pattern, causing us
to over-estimate memory on low-end devices.

This is a temporary fix that removes the Dalvik VM computation when on
a low-end device. Eventually we should clean up this code for all
Android devices.

Bug: 742534
Change-Id: I9325530d6dc8cc9369d6beb0dd072424e5b60be9
Reviewed-on: https://chromium-review.googlesource.com/571179
Commit-Queue: Eric Karl <ericrk@chromium.org>
Reviewed-by: default avatarAlexandre Elias <aelias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486843}
parent 80000ac0
...@@ -571,10 +571,18 @@ cc::ManagedMemoryPolicy RenderWidgetCompositor::GetGpuMemoryPolicy( ...@@ -571,10 +571,18 @@ cc::ManagedMemoryPolicy RenderWidgetCompositor::GetGpuMemoryPolicy(
size_t dalvik_mb = base::SysInfo::DalvikHeapSizeMB(); size_t dalvik_mb = base::SysInfo::DalvikHeapSizeMB();
size_t physical_mb = base::SysInfo::AmountOfPhysicalMemoryMB(); size_t physical_mb = base::SysInfo::AmountOfPhysicalMemoryMB();
size_t physical_memory_mb = 0; size_t physical_memory_mb = 0;
if (dalvik_mb >= 256) if (base::SysInfo::IsLowEndDevice()) {
// TODO(crbug.com/742534): The code below appears to no longer work.
// |dalvik_mb| no longer follows the expected heuristic pattern, causing us
// to over-estimate memory on low-end devices. This entire section probably
// needs to be re-written, but for now we can address the low-end Android
// issues by ignoring |dalvik_mb|.
physical_memory_mb = physical_mb;
} else if (dalvik_mb >= 256) {
physical_memory_mb = dalvik_mb * 4; physical_memory_mb = dalvik_mb * 4;
else } else {
physical_memory_mb = std::max(dalvik_mb * 4, (physical_mb * 4) / 3); physical_memory_mb = std::max(dalvik_mb * 4, (physical_mb * 4) / 3);
}
// Now we take a default of 1/8th of memory on high-memory devices, // Now we take a default of 1/8th of memory on high-memory devices,
// and gradually scale that back for low-memory devices (to be nicer // and gradually scale that back for low-memory devices (to be nicer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment