#411 Incorrect reading of free mem on OS X.

closed
nobody
Code (200)
5
2012-11-01
2012-08-23
Pär Boberg
No

Hi

I'm using phpsysinfo on my Snow Leopard 10.6.8 machine but the calculation of free memory and thus used memory is incorrect.
Currently phpsysinfo 3.0.19 shows 1.93Gb used and 1.07Gb free of a total of 3Gb memory, but the Activityviewer and Top shows 1.19Gb used and 1.88Gb free, so PSI is about 700Mb wrong!
But I found the solution for you, for PSI to show correct mem values you also have to add Pages Speculative, then the values match up with Top etc...
Solution came from this site: http://blog.55minutes.com/2012/05/taming-the-lion-inactive-memory-problem/
And specifically from this section:
free = pages2mb(RE_FREE.search(vmstat).group(1)) + \ pages2mb(RE_SPECULATIVE.search(vmstat).group(1))

Hope you can fix it!

Discussion

  • Pär Boberg
    Pär Boberg
    2012-08-24

    Works great now, thanks for the quick fix!

     
  • No problem. Improving the program is easy, but to test it on different platforms is the most time consuming so thanks for all notification.

     
    • status: open --> closed