#!/bin/bash
sync
echo 3 > /proc/sys/vm/drop_caches

Why would you want to do that? Linux uses buffers and cache intelligently – unused memory is wasted memory.
Yes, I do understand all of this. I found this to be useful when hibernating with TuxOnIce. Calling this script before hibernating results in much faster hibernates and resumes.
If using ArchLinux and hibernate-script a good place to put this would be /etc/hibernate/common.conf – add the following at this point in the file:

### misclaunch
# OnSuspend 20 echo "Good night!"
# OnResume 20 echo "Good morning!"
OnSuspend 95 /path/to/above/script