libmacchina icon indicating copy to clipboard operation
libmacchina copied to clipboard

macos memory usage incorrect

Open k2662 opened this issue 9 months ago • 8 comments

the reported memory usage is lower than shown in activity monitor.

k2662 avatar Apr 25 '24 16:04 k2662

How much do they differ? Can you provide examples?

Gobidev avatar Apr 25 '24 17:04 Gobidev

How much do they differ? Can you provide examples?

by up to 3GB. like: if actual was 12GB then it would show 9.3GB

k2662 avatar Apr 25 '24 18:04 k2662

Any update?

k2662 avatar May 08 '24 04:05 k2662

@k2662 Can you provide a screenshot of the memory usage reported by the activity monitor along with running vm_stat in a terminal? There are multiple options of what to count as used memory so it would be interesting to see what the activity monitor uses.

I don't own any device running macOS so testing is somewhat difficult. What I tried is running the libmacchina readouts and vm_stat on a macOS GitHub runner here, where the free memory reported by libmacchina approximately matches the free and inactive pages of vm_stat combined:

libmacchina:
reported free: 3330848 [kB] = 3410788352 Bytes

vm_stat:
reported free: 26076 [Pages] = 427229184 Bytes (1 Page = 16384 Bytes)
reported inactive: 183623 [Pages] = 3008479232 Bytes
free + inactive = 3435708416 Bytes

Gobidev avatar May 09 '24 12:05 Gobidev

@k2662 Can you provide a screenshot of the memory usage reported by the activity monitor along with running vm_stat in a terminal? There are multiple options of what to count as used memory so it would be interesting to see what the activity monitor uses.

I don't own any device running macOS so testing is somewhat difficult. What I tried is running the libmacchina readouts and vm_stat on a macOS GitHub runner here, where the free memory reported by libmacchina approximately matches the free and inactive pages of vm_stat combined:

libmacchina:
reported free: 3330848 [kB] = 3410788352 Bytes

vm_stat:
reported free: 26076 [Pages] = 427229184 Bytes (1 Page = 16384 Bytes)
reported inactive: 183623 [Pages] = 3008479232 Bytes
free + inactive = 3435708416 Bytes

image

image

k2662 avatar May 09 '24 15:05 k2662

Is this not being fixed?

k2662 avatar Sep 14 '24 01:09 k2662

Perhaps @123marvin123 can help us with this issue :)

grtcdr avatar Sep 14 '24 18:09 grtcdr

I believe this happens because Activity Monitor includes compressed memory as used memory. There are some discrepancies in how different apps report this metric. "iStat Menus" includes also the compressed memory, but many command line tools (e.g. https://github.com/giampaolo/psutil) do not.

So I'm not sure what is the best approach.

123marvin123 avatar Sep 14 '24 18:09 123marvin123