Skip to content

[JSC][GTK][WPE] Unify & improve process memory footprint calculation#56493

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
Scony:305382-unify-memory-footprint
Jan 14, 2026
Merged

[JSC][GTK][WPE] Unify & improve process memory footprint calculation#56493
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
Scony:305382-unify-memory-footprint

Conversation

@Scony
Copy link
Contributor

@Scony Scony commented Jan 13, 2026

2f2cff4

[JSC][GTK][WPE] Unify & improve process memory footprint calculation
https://bugs.webkit.org/show_bug.cgi?id=305382

Reviewed by Miguel Gomez.

While most of the ports calculate process memory footprint as being
close to RSS (WPE, Win, PS) or PSS (Apple), the GTK and JSC ports
calculate it as being close to USS which is <= RSS, PSS. Apart from
using differnt approximation for no strong reason, GTK and JSC ports
calculate memory footprint using /proc/self/smaps file which:
- may be nonexistent if disabled in kernel during run/compile-time
- is expensive to parse
- is expensive to serve by OS (much more than e.g. /proc/self/statm)

For the sake of performance and unification, this change:
- switches memoryFootprint() implementation in MemoryFootprintLinux.cpp
  to using resident (RSS) from currentProcessMemoryStatus() that parses
  /proc/self/statm and hence is faster to obtain as well as is the same
  to what MemoryFootprintGeneric.cpp uses in case of linux OSes (it
  uses /proc/self/statm via bmalloc::api::memoryFootprint())
- switches WPE port to using MemoryFootprintLinux.cpp thus just
  changing the code path that eventually reads the same value from
  the same file (/proc/self/statm)

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

4180b26

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 wpe-cairo-libwebrtc
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 vision ❌ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-intel-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🛠 mac-safer-cpp ✅ 🧪 jsc-armv7-tests
✅ 🛠 watch
✅ 🛠 watch-sim

@Scony Scony requested a review from a team as a code owner January 13, 2026 14:09
@Scony Scony self-assigned this Jan 13, 2026
@Scony Scony added the WPE WebKit WebKit WPE component label Jan 13, 2026
@Scony Scony added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Jan 14, 2026
https://bugs.webkit.org/show_bug.cgi?id=305382

Reviewed by Miguel Gomez.

While most of the ports calculate process memory footprint as being
close to RSS (WPE, Win, PS) or PSS (Apple), the GTK and JSC ports
calculate it as being close to USS which is <= RSS, PSS. Apart from
using differnt approximation for no strong reason, GTK and JSC ports
calculate memory footprint using /proc/self/smaps file which:
- may be nonexistent if disabled in kernel during run/compile-time
- is expensive to parse
- is expensive to serve by OS (much more than e.g. /proc/self/statm)

For the sake of performance and unification, this change:
- switches memoryFootprint() implementation in MemoryFootprintLinux.cpp
  to using resident (RSS) from currentProcessMemoryStatus() that parses
  /proc/self/statm and hence is faster to obtain as well as is the same
  to what MemoryFootprintGeneric.cpp uses in case of linux OSes (it
  uses /proc/self/statm via bmalloc::api::memoryFootprint())
- switches WPE port to using MemoryFootprintLinux.cpp thus just
  changing the code path that eventually reads the same value from
  the same file (/proc/self/statm)

Canonical link: https://commits.webkit.org/305569@main
@webkit-commit-queue webkit-commit-queue force-pushed the 305382-unify-memory-footprint branch from 4180b26 to 2f2cff4 Compare January 14, 2026 12:15
@webkit-commit-queue
Copy link
Collaborator

Committed 305569@main (2f2cff4): https://commits.webkit.org/305569@main

Reviewed commits have been landed. Closing PR #56493 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 2f2cff4 into WebKit:main Jan 14, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WPE WebKit WebKit WPE component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants