OSX has pre-built scripts that are scheduled to run at night and are responsible for several cleanup tasks.
Check
for the scripts that are run on a daily/weekly/monthly base.
http://www.ehow.com/how_5096934_run-mac-os-maintenance-scripts.html holds a reference for manually running the scripts.
Google may give you several results for tweaking these scripts but it's uncertain if this is really necessary.
Usually, as with any *nix system a very-very-long uptime should not produce any problems as long as there are no zombies
or leaking applications hanging around in your memory.