Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7cc8fd9a7f619404824d87202fdec42118b3dbd3
      
https://github.com/WebKit/WebKit/commit/7cc8fd9a7f619404824d87202fdec42118b3dbd3
  Author: Ben Nham <[email protected]>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M Source/WTF/wtf/AvailableMemory.cpp
    M Source/WTF/wtf/AvailableMemory.h
    M Source/WTF/wtf/generic/MemoryFootprintGeneric.cpp

  Log Message:
  -----------
  Fix AvailableMemory computation
https://bugs.webkit.org/show_bug.cgi?id=325827
rdar://problem/188834732

Reviewed by Ryan Reno and Yusuke Suzuki.

AvailableMemory tried to read the jetsam limit via 
MEMORYSTATUS_CMD_GET_MEMLIMIT_PROPERTIES, but
that didn't work because that syscall is blocked by the sandbox. Change this to 
use task_info
on the current task instead, which is allowed by the sandbox.

I also did some other cleanups to AvailableMemory:

 - memorySizeAccordingToKernel() is the same as 
ramSizeDisregardingJetsamLimit(), so I deleted it.
 - Changed availableMemoryGuess to a correct estimate of WebProcess jetsam 
limits on various
   platforms.
 - Remove isUnderMemoryPressure(); all callers were using the variant in 
MemoryPressureHandler
   instead.
 - Remove MemoryStatus and memoryStatus(). Those are only used by other ports 
so I moved that logic
   to MemoryFootprintGeneric.cpp instead.

One notable downstream effect here is that on iOS, we were previously always 
running with
availableMemory of 1024 MB due to the sandboxing issue instead of the actual 
jetsam limit (which is
generally 1536 MB of 2048 MB). This feeds in to JSC GC heuristics, which meant 
that previously we
were synchronously GC'ing more than we meant to on iOS.

* Source/WTF/wtf/AvailableMemory.cpp:
(WTF::jetsamLimit):
(WTF::computeAvailableMemory):
(WTF::percentAvailableMemoryInUse):
(WTF::memorySizeAccordingToKernel): Deleted.
(WTF::memoryStatus): Deleted.
(WTF::availableMemory):
(WTF::LinuxMemory::singleton): Deleted.
(WTF::LinuxMemory::footprint const): Deleted.
(): Deleted.
* Source/WTF/wtf/AvailableMemory.h:
(WTF::MemoryStatus::MemoryStatus): Deleted.
(WTF::percentAvailableMemoryInUse): Deleted.
(WTF::isUnderMemoryPressure): Deleted.
* Source/WTF/wtf/generic/MemoryFootprintGeneric.cpp:
(WTF::LinuxMemory::singleton):
(WTF::LinuxMemory::footprint const):
(WTF::memoryFootprint):

Canonical link: https://commits.webkit.org/322403@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to