7 Replies Latest reply: Oct 11, 2012 10:18 PM by BDAqua
William H. Magill1 Level 2 Level 2 (200 points)

I'm working with a Graphics heavy MMO -- It expects to be able to use over 4GM of memory.

 

My 27 inch iMac has 4GB of physical memory.

 

However, OSX page-faults every time the application wants more than 3.7 GB of memory.

Crashing the dispatch queue.

 

So far, the maximum number of Swapfiles I've "caught" is 6 for a total of 3 145 728 - 512 byte blocks.

 

ls -als /private/var/vm

total 3145728

      0 drwxr-xr-x   9 root  wheel         306 Oct 11 09:43 .

      0 drwxr-xr-x  26 root  wheel         884 Jul 28 17:43 ..

  65536 -rw-------   1 root  wheel    67108864 Oct 10 14:55 swapfile0

  65536 -rw-------   1 root  wheel    67108864 Oct 11 09:44 swapfile1

131072 -rw-------   1 root  wheel   134217728 Oct 11 09:44 swapfile2

262144 -rw-------   1 root  wheel   268435456 Oct 11 09:44 swapfile3

524288 -rw-------   1 root  wheel   536870912 Oct 11 09:44 swapfile4

1048576 -rw-------   1 root  wheel  1073741824 Oct 11 09:44 swapfile5

1048576 -rw-------   1 root  wheel  1073741824 Oct 11 09:44 swapfile6

 

From the consistancy of the crashes, it's clearly an issue with Virtual Memory allocation.

 

What I'm looking for is any explanation of the VM system in Mountain Lion.

Everything I can find is ancient, at best it describes Snow Leopard or Lion, and I know that Memory Management has changed in Mountain Lion.


iMac, OS X Mountain Lion (10.8.2), iMac Core i7 2.93GHz 4GB
  • 1. Re: Why won't 10.8.2 allocate over 3.7 GB of VM?
    BDAqua Level 10 Level 10 (116,475 points)

    Hi William, will try to see if it's the same on my 24"/10.8.2 later tonight, but why not add more real RAM?

     

    How much free space is on the Disk?

  • 2. Re: Why won't 10.8.2 allocate over 3.7 GB of VM?
    rkaufmann87 Level 8 Level 8 (42,145 points)

    William,

     

    The solution is very simple, add more RAM. 4GB in contemporary systems is now a bare minimum. You can expand up to 32GB (2010 & 2011 iMacs only) and RAM is very inexpensive.

  • 3. Re: Why won't 10.8.2 allocate over 3.7 GB of VM?
    BDAqua Level 10 Level 10 (116,475 points)

    Welll, I'm not sure what to think about this, in 10.8.2 I opened every App & eveey Utility, Systm profiler showed VM jumping up more than the Free Space on the Drive!??

    Terminal didn't...

    VM1082.gif

  • 4. Re: Why won't 10.8.2 allocate over 3.7 GB of VM?
    William H. Magill1 Level 2 Level 2 (200 points)

    I'm talking about the VM used by the individual App, not the aggregate VM in use across the system.

     

    In talking with an Apple tech person, we discovered that the app in question was a 32 bit app.

     

    By definition, only able to address 4GB of memory.

  • 5. Re: Why won't 10.8.2 allocate over 3.7 GB of VM?
    William H. Magill1 Level 2 Level 2 (200 points)

    The answer to "VM jumping up to more than the Fee Space on the Drive" is actually quite "simple."

     

    Virtual Memory is not really what everyone thinks it is. Part of it is actually the application itself on disk. Another, and in most cases, the primary portion, is simply "allocated," but not used. And I put "Allocated" in quotes because it is not allocated in a physical sense on the disk, but in a table in memory.

     

    Virtual Memory managemnt is a complex topic and for Mountain Lion, not documented. The Docs describing OSX virtual memory go back to Tiger for the most part. However, for Lion and Mountain Lion significant changes were made.

     

    One of the things I was looking for was the answer to the question -- does OSX use "Eager Swap" or Lazy Swap" and what do those terms mean to OSX. One term means "allocate the disk space for swapping this App at Launch." The other means "don't allocate the disk space until it is needed to swap the app out."

     

    Both are gross simplifications, but the basic idea.

  • 6. Re: Why won't 10.8.2 allocate over 3.7 GB of VM?
    William H. Magill1 Level 2 Level 2 (200 points)

    As for adding more physical ram -- that was the "red herring" in this situation. Since I had 4 GB of ram, it was obscuring the fact that it was a 32bit App, which can only address 4GB or memory!

     

    If I had had 8 or 16 GB, the question would have been more obvious -- Why is this App only using 4 GB or ram when there is another 4 or 12 GB available? Which would have made the answer more obvious.

  • 7. Re: Why won't 10.8.2 allocate over 3.7 GB of VM?
    BDAqua Level 10 Level 10 (116,475 points)

    AHA,  that would  explain it... good work, thanks!