L
L
Lici2015-02-18 21:30:41
macOS
Lici, 2015-02-18 21:30:41

What does memory compression actually do in Mac OS X? How does it work?

Here is a promotional text from Apple about it:

Free up memory.
The more free memory a Mac has, the faster it runs. But if you have multiple apps open at the same time, your Mac's free memory will decrease. In-memory compression technology frees up Mac memory as needed. When a Mac runs out of memory, OS X automatically compresses the data of inactive applications, freeing up some of the memory. By compressing memory, your Mac won't have to spend time constantly transferring data from memory to storage and back again. So he can do more in less time. And because compression and decompression are nearly instantaneous, you'll notice nothing more than incredibly fast response times.

So. I was prompted here on the toaster, and yes, it got better, sort of. But for some reason, this chip was introduced into Apple - I want to understand all the features of this system and understand what it gives and what it takes away.
I found this topic: maccentre.ru/board/viewtopic.php?p=843761 The
values ​​of the settings are not immediately clear:
- Disable memory compression and swap (requires reboot):
Code:
sudo nvram boot-args="vm_compressor=1"

So is it turning off memory compression and turning off swap compression, or is swap turned off altogether?
- Enable memory compression without swap compression (requires reboot):
Code:
sudo nvram boot-args="vm_compressor=2"

Memory compression is turned off, but what about the swap again? It stays but doesn't shrink anymore? What is compressed by default?
- Restore default settings (memory and swap compression enabled):
Code:
sudo nvram boot-args="vm_compressor=4"

Memory compression enabled and swap enabled? Or is memory compression and swap compression enabled?
Now further - how does this memory compression work? When it becomes small, what is usually customary to swap in Linux now starts to shrink and stay in RAM? What is the plus before the swap if this happens to the SSD in the system? Machine - rMBP 2014, 8Gb RAM, SSD 128Gb.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Belyaev, 2015-02-26
@PavelBelyaev

As practice shows, MacOS 10.9+ began to work not quite adequately, if I have a ton of software running, I don’t restart my computer for months, my web server is spinning, I have photoshop .... and only 8 gigabytes of memory.
Disabling swap, with 16 gigs of RAM, I caught the system freezing a couple of times a month, I had to turn it back on.
On a laptop, I watched the memory usage on a macbook
: at first, the memory is pressed for a long time, and then it is only unloaded into swap
2. The file cache is not always unloaded, for example, programs take 3 gigabytes, and the file cache 5, I run a virtual machine with 1 gigabyte of memory allocated, 1 gigabyte is freed from the file cache. But sometimes the swap starts to turn on, and the cache is never unloaded.
3. After clearing the memory, the swap is also not always unloaded into the RAM.
In general, 10.8 worked better, but in 10.9 and 10.10 something was tweaked, although in 10.10.2 it works more or less adequately, the computer almost does not freeze.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question