-
-
Notifications
You must be signed in to change notification settings - Fork 526

Description
I remember hearing from you all in the past that htop very intentionally calculates ram usage differently from top and also intentionally gives contradicting values between the two programs. You explained why you chose to do this but I can't remember what the reason was. Right now, how you do it is (active_count + wire_count) * page_size
, as can be seen here:
Line 305 in 28dcbd7
mtr->values[MEMORY_METER_USED] = (double)(vm->active_count + vm->wire_count) * page_K; |
This is what top(1) does: https://github.com/apple-opensource/top/blob/e7979606cf63270663a62cfe69f82d35cef9ba58/globalstats.c#L433-L435 Note this link is providing source code from an unofficial mirror of Apple's Open Source projects, because Apple's official source code repositories for top(1) have been taken away from public viewing. It is now closed-source I guess. It gets ram by doing (wire_count + inactive_count + active_count + compressor_page_count) * page_size
. See these other pull requests I've made for more details:
- Correct macOS Free and Available Memory godotengine/godot#100788
- Correct macOS Free and Available Memory Redot-Engine/redot-engine#906
- Correct macOS Used Memory. fastfetch-cli/fastfetch#1463
If you happen to like this idea and are willing to accept my code contribution I will go ahead and make a pull request.