If a Mac is left on during the middle of the night—I believe from 3-5 AM—it will run what are called cron scripts. These three scripts, daily, weekly, and monthly, do basic housekeeping—ie, removing scratch files, rotating log files around, cleaning up the system memory, etc.
Unfortunately for laptop users, these scripts almost never get run because laptops generally aren't kept on 24/7, and because of this they may start to seem less zippy than they were before.
Fortunately you can run them yourself... Open the Terminal and type "sudo /etc/daily", sans quotes of course, and when prompted enter your admin password.
After that has run type "sudo /etc/weekly" and once that is done type "sudo /etc/monthly". Also, I usually do a repair permissions either before or after I run the scripts just to get all my maintenance done at once.
And of course, restarting the computer will start you off with a completely new swap file and the memory will be completely devoid of any left over chaff...but you really shouldn't have to do it unless things still aren't fixed from the cron scripts.