Title: [295192] branches/safari-613-branch/Source/WTF
Revision
295192
Author
[email protected]
Date
2022-06-02 23:45:51 -0700 (Thu, 02 Jun 2022)

Log Message

Cherry-pick f822d46cdb31. rdar://problem/93265374

    Enforce foreground WebContent memory limit on macOS
    https://bugs.webkit.org/show_bug.cgi?id=240397

    Reviewed by Chris Dumez.

    We removed the foreground memory limit for WebContent on macOS in r272046. But based on some
    bug reports that we've seen, it seems like we need to restore some limit to prevent bad user
    outcomes when a misbehaving process has runaway memory usage.

    This patch adds a foreground memory limit of 8GB or 16GB depending on RAM size. This matches
    the limits set by other browsers for their content process.

    * wtf/MemoryPressureHandler.cpp:
    (WTF::thresholdForMemoryKillOfActiveProcess):
    (WTF::MemoryPressureHandler::thresholdForMemoryKill):

    Canonical link: https://commits.webkit.org/250548@main
    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294181 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WTF/ChangeLog (295191 => 295192)


--- branches/safari-613-branch/Source/WTF/ChangeLog	2022-06-03 06:45:49 UTC (rev 295191)
+++ branches/safari-613-branch/Source/WTF/ChangeLog	2022-06-03 06:45:51 UTC (rev 295192)
@@ -49,6 +49,24 @@
         (WTF::WorkQueueBase::platformInitialize):
         (WTF::WorkQueue::assertIsCurrent const):
         (WTF::currentSequenceID):
+2022-05-13  Ben Nham  <[email protected]>
+
+        Enforce foreground WebContent memory limit on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=240397
+
+        Reviewed by Chris Dumez.
+
+        We removed the foreground memory limit for WebContent on macOS in r272046. But based on some
+        bug reports that we've seen, it seems like we need to restore some limit to prevent bad user
+        outcomes when a misbehaving process has runaway memory usage.
+
+        This patch adds a foreground memory limit of 8GB or 16GB depending on RAM size. This matches
+        the limits set by other browsers for their content process.
+
+        * wtf/MemoryPressureHandler.cpp:
+        (WTF::thresholdForMemoryKillOfActiveProcess):
+        (WTF::MemoryPressureHandler::thresholdForMemoryKill):
+
         * wtf/generic/WorkQueueGeneric.cpp:
         (WTF::WorkQueueBase::platformInitialize):
         (WTF::WorkQueue::assertIsCurrent):

Modified: branches/safari-613-branch/Source/WTF/wtf/MemoryPressureHandler.cpp (295191 => 295192)


--- branches/safari-613-branch/Source/WTF/wtf/MemoryPressureHandler.cpp	2022-06-03 06:45:49 UTC (rev 295191)
+++ branches/safari-613-branch/Source/WTF/wtf/MemoryPressureHandler.cpp	2022-06-03 06:45:51 UTC (rev 295192)
@@ -95,6 +95,12 @@
 }
 #endif
 
+static size_t thresholdForMemoryKillOfActiveProcess(unsigned tabCount)
+{
+    size_t baseThreshold = ramSize() > 16 * GB ? 15 * GB : 7 * GB;
+    return baseThreshold + tabCount * GB;
+}
+
 static size_t thresholdForMemoryKillOfInactiveProcess(unsigned tabCount)
 {
 #if CPU(X86_64) || CPU(ARM64)
@@ -121,7 +127,7 @@
     case WebsamProcessState::Inactive:
         return thresholdForMemoryKillOfInactiveProcess(m_pageCount);
     case WebsamProcessState::Active:
-        break;
+        return thresholdForMemoryKillOfActiveProcess(m_pageCount);
     }
     return std::nullopt;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to