How to calculate application memory and cache memory like Activity Monitor in object C in Mac?

I am trying to write a MAC OSX system monitoring program (something similar to an activity monitor). I am using vm_statistics64_data_t to get "free_count, active_count, inactive_count" etc.

But I can't figure out the app memory correctly. I used

"vm_page_size * vmStats.internal_page_count"

to compute application memory, but it is out of sync with Activity Monitor.

+3


source to share


1 answer


It looks like you've already found the answer. Leave it here for those who may find it useful.

To calculate the application memory value corresponding to the activity monitor, you need:



vm_page_size * (vm_stat.internal_page_count - vm_stat.purgeable_count)

      

+1


source







All Articles