Why is my MacBook Pro already using swap memory?

Solution 1:

This is normal behavior. You are not experiencing any memory issues in your screenshot above. What I suspect is happening is that OS X is creating some placeholder of sorts to enable swap memory, rather than actually using swap memory here. I have never seen a zero in the swap memory section, unless I have just restarted and open the Activity Monitor window fresh, and even then, I rarely see zero.

With Mavericks and Yosemite, the way the OS uses memory changed a bit. Essentially, the OS takes all the memory, and then manages it out as needed. So, our traditional way of looking at the memory report in Activity Monitor is not really valid. Due to this, Mavericks added the 'Memory Pressure' gauge, to give you an idea of when you have a limitation caused by memory. In your screenshot, you have a green memory pressure. For more see this answer.

Ars Technica has a nice description of this 'memory compression' in their Mavericks review:

http://arstechnica.com/apple/2013/10/os-x-10-9/17/

Solution 2:

According to what I can understand from your screenshot (I don't know your language), you're only using 256KB of swap space, which is nothing. I wouln't worry unless your memory pressure went up

Solution 3:

You would need to be monitoring the memory and swap usage as the swap file was created to have a chance to understand why the swap was created. Based on what you describe in text and in the screen shot, I see nothing that is concerning.

As to why swap was created when you assume you had free RAM. The OS can move to swap based on predictive measures. For example, maybe you started up Photoshop which had several large image files automatically reopen from a prior session. The OS could see that there was suddenly a huge new demand on RAM, and moved some unused RAM content to swap in advanced of an expected need.

Or your backup program briefly ran in the background, and did a huge number of file checksums and comparisons and created large RAM based data structures, pushing other content to swap. Then the backup program released its RAM and went back to sleep.

Mac OS X (and most modern OS: Windows, Linux, etc) are very intelligent about automatically using Cache, Swap, memory compression and other techniques to keep the system running as fast as possible. I really would not be worrying about this unless you see that the Activity Monitor is reporting that Memory Pressure is in the Yellow or Red zone.

I currently have a 2010 13" MacBook Pro that has 16GB of RAM. I do lots of work that is heavy on RAM usages. (Web Development, data mining, running many heavy duty apps at the same time.) Even with 16GB I sometimes hit the Yellow zone for memory pressure. But I have to say this is seldom an issue because Mac OS X is very good about allocating resources as needed.

While I need the 16GB of RAM for my work, you should know that such an upgrade is not without negatives. The extra RAM does significantly reduce battery life both in active usage and in sleep.