OS X virtual memory size can't be correct, can it?

1

I've got Snow Leopard and 8G of RAM. Activity Monitor reports a VM size of 173 Gigabytes. My hard disk is only 250G and 200G of that is in use. I've got a lot more data than 27 GB on my hard disk. So the virtual memory size cannot really be 173GB, surely?

fairflow

Posted 2012-04-25T10:47:31.640

Reputation: 185

I have 260 GB there, whoop whoop. – slhck – 2012-04-25T11:03:43.227

VMware Fusion sometimes has petabytes or exabytes of virtual memory on my system. – Daniel Beck – 2012-04-26T17:21:59.490

Answers

4

Virtual memory is not completely occupied all the time. Your mac probably has set maximum limit for virtual memory to 173 GB.

That does not mean all 173 GB memory has been allocated. It will be allocated as per requirement.

I don't think more than 8 GB of it will ever be allocated unless you use some insanely RAM hungry application.

tumchaaditya

Posted 2012-04-25T10:47:31.640

Reputation: 3 624

Well, according to Activity Monitor, the VM goes up and down, sometimes reaching 250G. There doesn't seem to be a maximum value. We must both be correct in saying that the VM as reported can't be actually used, and perhaps it is simply a glitch in Activity Monitor. Thanks for your reply! – fairflow – 2012-04-25T11:11:35.027

Yup, there's no maximum defined, at least none that I know of. Unless you experience performance issues, no need to worry @fairflow – slhck – 2012-04-25T11:15:43.367

0

I have a VM size of 350 GB.

The VM size does not actually reflect any resource in use, nor is it a limit. It is the sum of the address space sizes (ps -ax -O vsz will show these) for all running processes. The address space size is simply the largest number being used by that process to refer to locations in memory; memory below that value may not even be allocated to any purpose.

Here's just one example of why there would be such gaps:

Multiple programs may use shared libraries of code (also sometimes known as frameworks), such as Cocoa. In order to efficiently start up a program, these shared libraries are arranged so that each library on your system (mostly) is at a different virtual address — this means that when the program is loaded, its code that refers to the library can already point to that address and does not need to be rewritten with different addresses (relocation or dynamic linking). But not every program uses every library, so there will be gaps.

(I'm not an expert on these matters; some specific details may be off. Consider the above a guide to the sort of complexity that can exist in a modern system, not exactly how it actually does work.)

Kevin Reid

Posted 2012-04-25T10:47:31.640

Reputation: 2 854