I have a Macbook Air with 8GB or RAM and an SSD. Recently, I've been doing a lot of high-RAM-use tasks (like image processing) in MATLAB. I noticed that it uses a very large amount of RAM, which in this case means using my SSD. I'm concerned that this will shorten the life of my SSD. Is this something I should not worry about, or should I try to limit/disable virtual RAM?
To disable swap (pager daemon) run this command in Terminal:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
After stopping pager daemon, you may want to remove swapfiles by this command:
sudo rm /private/var/vm/swapfile*
To enable swap, you need to boot in Single Mode (Hold [CMD + S] at booting time) and run this command:
sudo launchctl load /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
While any read/writes will lower the life of a SSD drive, you do have to consider the tradeoff of being able to perform the necessary tasks at hand which will use the SSD. Alternatively, you could get a Thunderbolt drive and put your SWAP file on there. However, you'd be tethering yourself to an external device which almost defeats the purpose of mobility.
Using a SWAP file on your SSD drive does shorten the life of the SSD. So does booting the OS, browsing the internet and listening to music in iTunes.
Realistically, I wouldn't worry about it. Leave SWAP enabled on the SSD. Here is an interesting article to read regarding the lifespan of SSDs during endurance testing. From their experience, they had several SSD drives that would last over 500TB worth of writes. http://techreport.com/review/26523/the-ssd-endurance-experiment-casualties-on-the-way-to-a-petabyte
This is very unlikely to be a problem. Your system will only hit swap (the SSD) when it is absolutely necessary. If you are concerned about RAM usage, your best bet is to make sure no other applications are open. If whatever you are doing in MATLAB requires 8+ GB of RAM there is nothing you can do about that, don't worry.
Yo don't have anything to worry about. Flash memory is typically good for at least 10,000 cycles. Even if you are swapping like absolute mad and generating 100 MB/s of writes, and do this for 3 hours a day, every day, for a year, that would be 394,200 GB written. On a 128 GB SSD, that is only 3079 write cycles per flash page, so even if you are working it this ridiculously hard, it would still last for 3 years.