5

Update:

So, restarting the mac did the work but any known reason for this bug?


I'm using vm_stat to calculate RAM info like here

But when I try to add all the values and multiply it with page size im getting approx. 1.3gb less.

Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free:                               22064.
Pages active:                            580105.
Pages inactive:                          472217.
Pages speculative:                         5594.
Pages throttled:                              0.
Pages wired down:                        559999.
Pages purgeable:                          29101.
"Translation faults":                 261945239.
Pages copy-on-write:                    6941679.
Pages zero filled:                    165324784.
Pages reactivated:                     14573079.
Pages purged:                           1602247.
File-backed pages:                       203023.
Anonymous pages:                         854893.
Pages stored in compressor:             1732046.
Pages occupied by compressor:            456427.
Decompressions:                        11423912.
Compressions:                          20641865.
Pageins:                                4475678.
Pageouts:                                 32877.
Swapins:                                1714616.
Swapouts:                               2389086.

So by adding first 6 values and multiplying with page size, im getting 6.7GB but my mac has 8GB.

So what is going wrong?

Thank you!


Here is the result

enter image description here


After the reboot

enter image description here

Community
  • 1
  • 1
  • If you run the command `system_profiler | grep -A 7 "DIMM"` what does it output? – l'L'l Aug 01 '16 at 17:20
  • @l'L'l It shows there are two slots `BANK 0/DIMM0` and `BANK 1/DIMM1` and each of size `4GB` –  Aug 01 '16 at 17:46
  • Does the "status" show "OK" for both? also try running `sysctl hw.memsize` – l'L'l Aug 01 '16 at 17:47
  • @l'L'l Both are "OK". running `sysctl` gives `8589934592`. I've uploaded screenshot. –  Aug 01 '16 at 17:54
  • Everything looks fine on the hardware end, so maybe try `sudo purge` and then run `vm_stat`... – l'L'l Aug 01 '16 at 18:28
  • 1
    @l'L'l Doing above command didnt change the output. So, I just restarted mac and now im getting same value as `hw.memsize` now. Thanks! –  Aug 01 '16 at 19:08
  • I would be curious what the `vm_stat` numbers look like now that you've rebooted, and where the discrepancy might've been. – l'L'l Aug 01 '16 at 20:02
  • @l'L'l Added the after reboot image –  Aug 01 '16 at 20:19
  • You might consider adding a new answer to the other question linked ( http://stackoverflow.com/questions/8782228/retrieve-ram-info-on-a-mac/8782351#8782351 ), since there's obviously new data that needs to be taken into account. If you do I'll up-vote it since I think it would be pretty helpful info ... – l'L'l Aug 01 '16 at 20:31

1 Answers1

4

It looks to me like you need to add in "Pages occupied by compressor". That gets you to almost exactly 8GB. The reboot probably just reset that to zero so it didn't matter.

Ken Thomases
  • 88,520
  • 7
  • 116
  • 154
  • I think you are correct, taking that into account the total is `8563965952`... which is really close. – l'L'l Aug 01 '16 at 20:10
  • You are right! After the reboot, `Pages occupied by compressor` is `0`. –  Aug 01 '16 at 20:20