Question: I recently upgraded my mid-2011 15” MacBook Pro to Mac OS X 10.9 Mavericks. Since then, my computer’s RAM usage spikes to the point of making my computer unusable. Specifically, anywhere between a minute and 2 hours after booting up, the process `kernel_task` will use between 4 and 5 GB of RAM (I have 8 GB installed) and `mds` and `mds_store` will use around 2 GB between them. At that point all of my apps become unresponsive. 

If I don't restart my computer within about five minutes of this happening, Mac OS X will ask me to quit all of my apps. If I don’t do that the computer becomes totally unresponsive (even to restart requests) and I have to perform a hard shutdown. If I do, the same thing happens but it takes a couple minutes longer. I talked to an Apple representative and he said to flash my PRAM and reset the SMC, which I did, but nothing happened. 

Aside from that he said to send my device in, which I can’t do at the moment. Any idea what's going on?

Answer: 
I experienced `kernel_task` ballooning up to 20GB of RAM and saturating (but not releasing) all available RAM, which essentially froze all of my running apps. Through trial and error I found that it was a runaway R process, as after I quit the R application, the `kernel_task` went back down to a reasonable 1GB (the R.app did not require more than 1GB of memory at that time). 

So the specific fix for my scenario was to restart the R.app application. You might try quitting all running apps one-by-one to systematically figure out which one might be interacting with `kernel_task` and causing the issue.
I had the same problem. After months of memory pressure, I found the cure.

If your mail-account (hosted exchange or imap) contains a lot of duplicates - in my case thousands - spotlight indexing causes havoc. I assume, it is trying to compare all duplicates, so it can show them as one message.

If your iOS mail app shows different unread counts for the same mail folders from your OS X mail app, this is a certain indication for duplicates. Same, if you iOS shows emails, while OS X mail shows an empty folder.

Duplicates may result from incomplete move/copy/delete or from receiving multiple copies of the same mail.

I used <https://github.com/quentinsf/IMAPdedup> to go through all folders and delete duplicates automatically. This compares message-IDs or headers.

After that, neither of my macs has seen memory pressure again - ever.

I hope this helps everyone that suffers from memory pressure as I did.