Since installing Yosemite, I’ve had a recurring issue with the two processes kernal_task and mds_stores. Both would take up gobs of memory, even to the point of consuming all system resources and locking the computer up, requiring a forced reboot. I eventually narrowed the error down a corrupt Spotlight cache. Here’s how I resolved the issue:

  1. Go into System Preferences > Spotlight > Privacy
  2. Add each and every hard drive your computer has access to the list
  3. In Terminal, run this command: sudo mdutil -Ea, which allows you to verify that the local Spotlight index was removed from all local volumes.
  4. Finally, in System Preferences, remove all disks from the list

Since rebuilding the Spotlight index, I have not seen kernal_task or mds_stores runaway.