You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Being brief, the memory and memory2 blocks give hilariously different results.
Best I can tell the math used by the memory2 block to calculate free ram is wrong. The block uses an assumption like 'Used Memory = Total Memory - Free Memory' however Linux tries very hard to not actually leave any wasted 'free' memory floating around. Instead the correct way to calculate it would be something like:
'Actual Memory Usage = Total - (Free + Buffers + Cached)' (I got the math from https://scoutapm.com/blog/determining-free-memory-on-linux )
This is why the script (memory) says for example I am only using 30% of my ram but the C program (memory2) says I am using 99%.
The text was updated successfully, but these errors were encountered:
Seems like the sysinfo system call doesn't provide info on cache memory unfortunately... so some direct parsing of /proc/meminfo would have to be done.
Hello,
I just want to bring these two merge requests to your attention: #389#442
Maybe one of them solves the problem.
In the meantime, I'm working on memory3, which does what @carreter suggested about parsing /proc/meminfo. I'm looking at the source code of procps and htop to find out exactly how they compute the ram usage. For now it's in its own repo, but I will make a merge request here when it's done (even though it will probably never be merged, but who knows).
Being brief, the memory and memory2 blocks give hilariously different results.
Best I can tell the math used by the memory2 block to calculate free ram is wrong. The block uses an assumption like 'Used Memory = Total Memory - Free Memory' however Linux tries very hard to not actually leave any wasted 'free' memory floating around. Instead the correct way to calculate it would be something like:
'Actual Memory Usage = Total - (Free + Buffers + Cached)' (I got the math from https://scoutapm.com/blog/determining-free-memory-on-linux )
This is why the script (memory) says for example I am only using 30% of my ram but the C program (memory2) says I am using 99%.
The text was updated successfully, but these errors were encountered: