4

The free command displays the buffer and cache memory on Linux. What is the command to show the equivalent information for an OS X machine?

  • Find it? or purge it? to purge use the "sudo purge" – Ruskes Oct 13 '14 at 21:55
  • What do you want to do with the information - memory management is not necessarily the same as on Linux – Mark Oct 13 '14 at 23:04
  • look in ~/Library/Caches if that is what you are after. – Ruskes Oct 13 '14 at 23:25
  • I am using the Buffer cache information for displaying memory management details.I am not looking for purge option. I want to know how much memory is assigned to Buffer Cache. – user95535 Oct 14 '14 at 17:40
  • and what would you do with that information - the issue is what behaviour are you trying to manage – Mark Oct 14 '14 at 18:08
4

vm_stat may just show you what you need. As per the man page:

vm_stat -- show Mach virtual memory statistics

It can show you the following:

  • Pages free
  • Pages active
  • Pages inactive
  • Pages speculative
  • Pages throttled
  • Pages wired down
  • Pages purgeable
  • "Translation faults"
  • Pages copy-on-write
  • Pages zero filled
  • Pages reactivated
  • Pages purged
  • File-backed pages
  • Anonymous pages
  • Pages stored in compressor
  • Pages occupied by compressor
  • Decompressions
  • Compressions
  • Pageins
  • Pageouts
  • Swapins
  • Swapouts
  • Which value of vm_stat corresponds to Buffer Cache? – user95535 Oct 14 '14 at 17:41
  • 1
    Actually, from what I understand, there's no way to inspect the buffer cache. It seems OSX is just using regular memory for caching files. Note, according to this answer on stackoverflow.com: stackoverflow.com/questions/459537/… calling sync(2) several times in a row (three suggested) clears the cache. You can also run purge(8) command to achieve the same. If you just need to know how much memory was allocated to buffer cache, compare available memory before and after running purge - that might just give you an idea. – mike Oct 16 '14 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .