[PSON] Disable WebContent process cache on devices with less than 3GB of RAM
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Feb 2019 00:35:05 +0000 (00:35 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Feb 2019 00:35:05 +0000 (00:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194726
<rdar://problem/48126255>

Reviewed by Geoffrey Garen.

* UIProcess/WebProcessCache.cpp:
(WebKit::WebProcessCache::updateCapacity):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241631 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebProcessCache.cpp

index 61c6d31..6d5fb64 100644 (file)
@@ -1,3 +1,14 @@
+2019-02-15  Chris Dumez  <cdumez@apple.com>
+
+        [PSON] Disable WebContent process cache on devices with less than 3GB of RAM
+        https://bugs.webkit.org/show_bug.cgi?id=194726
+        <rdar://problem/48126255>
+
+        Reviewed by Geoffrey Garen.
+
+        * UIProcess/WebProcessCache.cpp:
+        (WebKit::WebProcessCache::updateCapacity):
+
 2019-02-15  Andy Estes  <aestes@apple.com>
 
         [iOS] Stop setting a background color on the PDF host view
index 756cb53..4f98457 100644 (file)
@@ -104,10 +104,14 @@ void WebProcessCache::updateCapacity(WebProcessPool& processPool)
         m_capacity = 0;
     } else {
         size_t memorySize = ramSize() / GB;
-
-        // Allow 4 processes in the cache per GB of RAM, up to 30 processes.
-        m_capacity = std::min<unsigned>(memorySize * 4, 30);
-        RELEASE_LOG(ProcessSwapping, "%p - WebProcessCache::updateCapacity: Cache has a capacity of %u processes", this, capacity());
+        if (memorySize < 3) {
+            m_capacity = 0;
+            RELEASE_LOG(ProcessSwapping, "%p - WebProcessCache::updateCapacity: Cache is disabled because device does not have enough RAM", this);
+        } else {
+            // Allow 4 processes in the cache per GB of RAM, up to 30 processes.
+            m_capacity = std::min<unsigned>(memorySize * 4, 30);
+            RELEASE_LOG(ProcessSwapping, "%p - WebProcessCache::updateCapacity: Cache has a capacity of %u processes", this, capacity());
+        }
     }
 
     if (!m_capacity)