yujitach / MenuMeters

my fork of MenuMeters by http://www.ragingmenace.com/software/menumeters/
GNU General Public License v2.0
3.02k stars 223 forks source link

Memory pressure BS high? #232

Open LiroyvH opened 3 years ago

LiroyvH commented 3 years ago

Hi,

Since an update a few days ago, the memory pressure suddenly shows as being very high in Big Sur. According to MenuMeters its 80% ("level 1") for example as I write this. However, Activity Monitor shows far from such a number and is more hovering around 25% pressure at worst. (They don't show a percentage unfortunately, but it occupies a small portion of the graph square; memory_pressure proclaims 80% system-wide memory free percentage; but I'll admit not knowing if that is relevant/can be relied upon to calculate anything in regards to memory pressure.)

In the full memory stats, it also shows there's a significant amount of memory available. (More than 60%, barring caches.) All-in-all, I cannot figure out why MM is suddenly showing a very high memory pressure whilst all other statistics show something different than before the updates and thus am suspecting I might be hitting a bug. It's almost as if it's reversing it, so it's saying 80% pressure instead of 20% pressure.

-edit- Double checked: apparently MenuMeters is taking the "System-wide memory free percentage" and shows that as the memory pressure? Not sure if that's accurate.

-edit2- Simulated critical memory levels and I noticed that it went to "level 4" now instead of "level 1". No idea what on earth the levels are and represent, but apparently there's four levels now? :P Also does show the graph in activity monitor is absolutely useless as it doesn't scale, you really need the CLI for this one, lol. So I'm guessing 75% in level 1 is pretty good, but 80% in level 4 = bad news. However, the memory pressure icon that's always on display now thus pretty much always shows it's nearly at 100% memory pressure. That's confusing. Maybe this can take the "levels" in to account? So 75% level 1 shows as +/- 1/5th of the graph (100% level 1 would be 1/4th), etc.? Because now what happens is when I simulate critical memory levels: the bar/meter hardly moves at all, the jump from level 1 to level 4 makes no difference; but we did go from a perfectly healthy state (75% lvl1) to critical state (80% lvl4)... So maybe there's some room for improvement there somehow haha. :)

LiroyvH commented 3 years ago

Guessing this isn't under dev or not interesting enough of an issue haha. Will close now :)

yujitach commented 3 years ago

You didn't have to close; sorry for not having time to address this issue. In the last half a year I really haven't had much time to pay attention to MenuMeters. Please keep it open.

As for the memory pressure, the problem is the following: the API I'm using to get the memory pressure is what Apple doc says should report the memory pressure, but it is not what Activity Monitor actually uses. And I don't know which API the Activity Monitor is using. Gee.

yujitach commented 3 years ago

If you're on the latest mac OS, you should try https://github.com/exelban/stats/ or https://iglance.github.io or https://github.com/gao-sun/eul .

LiroyvH commented 3 years ago

@yujitach No problem at all! I usually just sift through my list of open issues and periodically close anything that was fixed or didn't get a response, keeps it clean haha. I'll keep it open then, thanks! And thank you for your responses and recommendations!

Maybe it isn't using an API but just getting it directly from proc or kernel? Much like how terminal scripts do the trick. Or am I saying something idiotic now? :)