⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 295192 in webkit


Ignore:
Timestamp:
Jun 2, 2022, 11:45:51 PM (4 years ago)
Author:
Alan Coon
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

Location:
branches/safari-613-branch/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-613-branch/Source/WTF/ChangeLog

    r295174 r295192  
    5050        (WTF::WorkQueue::assertIsCurrent const):
    5151        (WTF::currentSequenceID):
     522022-05-13  Ben Nham  <nham@apple.com>
     53
     54        Enforce foreground WebContent memory limit on macOS
     55        https://bugs.webkit.org/show_bug.cgi?id=240397
     56
     57        Reviewed by Chris Dumez.
     58
     59        We removed the foreground memory limit for WebContent on macOS in r272046. But based on some
     60        bug reports that we've seen, it seems like we need to restore some limit to prevent bad user
     61        outcomes when a misbehaving process has runaway memory usage.
     62
     63        This patch adds a foreground memory limit of 8GB or 16GB depending on RAM size. This matches
     64        the limits set by other browsers for their content process.
     65
     66        * wtf/MemoryPressureHandler.cpp:
     67        (WTF::thresholdForMemoryKillOfActiveProcess):
     68        (WTF::MemoryPressureHandler::thresholdForMemoryKill):
     69
    5270        * wtf/generic/WorkQueueGeneric.cpp:
    5371        (WTF::WorkQueueBase::platformInitialize):
  • branches/safari-613-branch/Source/WTF/wtf/MemoryPressureHandler.cpp

    r285648 r295192  
    9696#endif
    9797
     98static size_t thresholdForMemoryKillOfActiveProcess(unsigned tabCount)
     99{
     100    size_t baseThreshold = ramSize() > 16 * GB ? 15 * GB : 7 * GB;
     101    return baseThreshold + tabCount * GB;
     102}
     103
    98104static size_t thresholdForMemoryKillOfInactiveProcess(unsigned tabCount)
    99105{
    … …  
    122128        return thresholdForMemoryKillOfInactiveProcess(m_pageCount);
    123129    case WebsamProcessState::Active:
    124         break;
     130        return thresholdForMemoryKillOfActiveProcess(m_pageCount);
    125131    }
    126132    return std::nullopt;
Note: See TracChangeset for help on using the changeset viewer.