Mac OS X maintains an image of memory when going to sleep. This same file is read upon waking up to restore the desktop to the same state as going sleep.
The sleepimage is located in the folder /private/var/vm. You can view the file as shown below:
I have 8Gig of memory on this machine, notice the sleepimage file is the same size.
A few times have come up where deleting the sleepimage has been helpful. For example, when upgrading to a new OS my system would reboot after each sleep cycle. Once I deleted the sleepimage, the sleep/restore cycle worked as expected.
To Delete Mac OS X SleepImage
sudo rm /private/var/vm/sleepimage
Before the file is deleted you will be prompted for the admin password.