Why does OS X use virtual memory when I still have free RAM

memoryvirtual-memory

I have this awesome MacBook Pro with 8 GB of RAM. When I open up Activity Monitor it would seem that I have plenty of RAM available, but my computer seems to prefer to use virtual memory for many things. Why is this? Is there a way to change it? Would it be wise to?

Also,I seem to have 7 GB of pageins and no pageouts. Is that normal? That's a lot of data.

Best Answer

You seem to misunderstand virtual memory. Virtual memory is simply a mechanism that the OS uses to make it look like each program has its own, extremely large (4GB on 32-bit, 16 EB on 64-bit) address space. It also provides a way for the OS to use paging, all while making it look like (to applications) only real RAM is being used. In short, it's only an abstraction, and the "Virtual Memory" stats in Activity Monitor are meaningless (for 99% of use cases). You should not be worried at all about whatever number appears there, because it has nothing to do with whether "real" RAM is being used or not.

About your paging stats : you gave no details on how you use your system, so it's hard to know whether something's wrong or not, but I wouldn't be alarmed by a value of 7 GB. Also note that the reported values are Page ins/outs since boot, so if you keep your laptop on all the time like me, it's no wonder that the number accumulates after a while.