Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble Understanding Inactive Memory in MacOSX

I thought that I understood how MacOSX manages memory, but recently I’ve become baffled by its performance. Here is the situation:

  1. I have a brand new Core i7 system with 8GB of physical memory running MacOSX 10.6.7.
  2. There are a few Apps running regularly taking up some of the memory—Safari, Mail, Xcode, Terminal, etc.
  3. I need to run three 64-bit processes in parallel, each of which uses about 2000M of real memory.
  4. Although the wired memory stays below 1000M (i.e. I have over 7000M available for processes), I see heavy paging activity leading to very bad performance from the three memory-intensive processes that I launched.
  5. Apparently, I am not running out of available RAM, as the reported inactive memory stays around 2500M and the active memory doesn’t rise above 5000M.

Can anyone give me a clue as to why MacOSX does not release the inactive memory for the processes that need it, instead resorting to paging? Also, is there any proper way to influence the memory management by the system?

The only thing that has come to my mind is that the 32-bit kernel might be the limiting factor, although I’m not sure why. I know that you can boot MacOSX with a 64-bit kernel, but then I won’t be able to load a number of 32-bit Apps, so that’s not an option for me.

like image 953
Ventzi Zhechev Avatar asked Apr 01 '11 09:04

Ventzi Zhechev


People also ask

What does inactive memory mean on Mac?

Inactive RAM. This is the amount that has recently been used but is no longer required. It may have been used by a recently quit process, or by an active one that no longer needs it, and is not required for use.

How do I find out what processes are taking up memory on my Mac?

In the Activity Monitor app on your Mac, click Memory (or use the Touch Bar) to see the following in the bottom of the window: Memory Pressure: Graphically represents how efficiently your memory is serving your processing needs.

What does inactive memory mean?

Definition of Inactive memory: The total amount of buffer or page cache memory that are free and available. This is memory that has not been recently utilized by any application for some time and can be reclaimed for other purposes by the paging algorithm.


1 Answers

Well, apparently the required workaround is to use the purge command on MacOSX. This will clear the caches marking most of the inactive memory as free. It seems that the OS keeps as much inactive memory as possible in order to improve the responsiveness of the GUI, which unfortunately impacts the performance of some memory-intensive tools.

There is a thread with some extra information on a sister site.

I wonder whether MacOSX Server might be tuned to release more of the inactive memory for non-GUI processes…

like image 111
Ventzi Zhechev Avatar answered Oct 01 '22 05:10

Ventzi Zhechev