Commit 90f5cc8f authored by ppi@chromium.org's avatar ppi@chromium.org

Limit dead resource capacity in Blink cache to 50%.

Blink resource cache distinguishes between live and dead resources depending on
whether clients of the resources are still around.

The cache capacity is defined in terms of total capacity and dead resource
capacity - the part of total capacity that may be consumed by dead resources.

Currently  we explicitly set "max_dead_capacity = capacity;", i.e. we allow
dead resources to potentially consume all of the cache space. While keeping
some dead resources around makes sense from the performance perspective,
allowing them to constitute a majority of cache space makes renderers that are
used for long one-site multiple-pages browsing sessions bloat with resources of
little value.

This patch limits dead resource capacity to 50% of total cache capacity,
putting a cap on dead resource bloat for long-lived renderers.

BUG=260662

Review URL: https://chromiumcodereview.appspot.com/19392003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212392 0039d316-1c4b-4281-b951-d872f2087c98
parent 8bac37b5
......@@ -315,15 +315,13 @@ void WebCacheManager::EnactStrategy(const AllocationStrategy& strategy) {
// This is the capacity this renderer has been allocated.
size_t capacity = allocation->second;
// We don't reserve any space for dead objects in the cache. Instead, we
// prefer to keep live objects around. There is probably some performance
// We don't reserve any space for dead objects in the cache. Instead, we
// prefer to keep live objects around. There is probably some performance
// tuning to be done here.
size_t min_dead_capacity = 0;
// We allow the dead objects to consume all of the cache, if the renderer
// so desires. If we wanted this memory, we would have set the total
// capacity lower.
size_t max_dead_capacity = capacity;
// We allow the dead objects to consume up to half of the cache capacity.
size_t max_dead_capacity = capacity / 2;
host->Send(new ChromeViewMsg_SetCacheCapacities(min_dead_capacity,
max_dead_capacity,
......
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