fix: improve RAM usage calculation and top processes#3160
Open
agentHits wants to merge 1 commit intoexelban:masterfrom
Open
fix: improve RAM usage calculation and top processes#3160agentHits wants to merge 1 commit intoexelban:masterfrom
agentHits wants to merge 1 commit intoexelban:masterfrom
Conversation
This PR fixes two RAM-related issues: - the used memory value is now closer to Activity Monitor - the top processes list now uses more accurate RAM data and preserves real process names in non-combined mode ### Changes - adjusted RAM breakdown calculation in `Modules/RAM/readers.swift` - switched top process memory usage to `proc_pid_rusage(..., ri_phys_footprint)` - improved process name resolution for helper/web content processes - refreshed the RAM process list immediately after RAM settings changes ### Tests - updated `Tests/RAM.swift` - verified with: ```bash xcodebuild test \ -project Stats.xcodeproj \ -scheme Stats \ -destination 'platform=macOS' \ -only-testing:Tests/RAM \ CODE_SIGNING_ALLOWED=NO \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGN_IDENTITY=''
exelban
reviewed
Apr 26, 2026
|
|
||
| self.settingsView.callback = { [weak self] in | ||
| self?.usageReader?.read() | ||
| self?.processReader?.read() |
Owner
There was a problem hiding this comment.
why open settings trigger process read?
exelban
reviewed
Apr 26, 2026
| import Darwin | ||
| import Kit | ||
|
|
||
| @_silgen_name("proc_pid_rusage") |
Owner
There was a problem hiding this comment.
please avoid using @_silgen_name
Owner
|
too many changes in one PR. You not only trying to improve RAM usage calculation, but also rewrite the whole top process logic. Too much in one PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes two RAM-related issues:
Changes
Modules/RAM/readers.swiftproc_pid_rusage(..., ri_phys_footprint)Tests
Tests/RAM.swift