-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RAM informations are wrong on Darwin OS #112
Comments
Hey, Thanks for the report. This problem is likely due to the mac sysctl entries being bounded by the size of a 32bit integer, which is why the value for hw.usermem overflowed and became negative. This wasn't caught when the Linfo Darwin OS class was written 10 years ago as computers had less ram back then. The proper fix here is to have Linfo execute vm_stat and regex-match out the right values, as opposed to the current implementation which tries extract the info from sysctl. While the top shell pipeline approach would work, it's more efficient to execute just one command (vm_stat) as opposed to executing 4. |
Yeah sure it's better to use vm_stat, will you fix it soon ? |
Per 6ce9284 I've committed a patch that "fixes" the value being reported as negative. It still isn't accurate though as it doesn't take into account memory which is used for filesystem cache nor compressed memory regions |
Ok nice, thanks you! |
Hello,
I'm using Mac OS 10.15.6 (Catalina) and getRam function return incorrect result.
Here explained :
Result :
As you can see, free mem is greater than available.
sysctl hw.usermem
return `hw.usermem: -216473600'. So I try to take only the absolute value (216473600) but it still wrong.My current free RAM is about 3Gb.
A little trick allow me to get the free RAM in Dawin.php (I don't like to "unitPows trick but... it works)
Gives me
2008023040
(2Gb because my RAM available is about 2Gb ^^)Hope you will find a fix with
sysctl
velse I can make a merge request to put modification.The text was updated successfully, but these errors were encountered: