For the longest time, I was battling a problem with my MacBook where it would crash maybe 33% of the time, when you closed the LID. I had done every trick in the book, but the problem remained. I was convinced it was a hardware problem and just lived with it. Then I got a brand new Macbook and it was doing the same thing! I couldn't believe it, I was so pissed!!
Then finally, I stumbled upon the answer! Newer Mac Laptops use a feature called Safe Sleep, where the computer writes the contents of your RAM to the hard drive. That way, if your MacBook is sleeping and the battery completely dies, your computer can still resume from where you left off once you plug it in.
This greatly slows down the process of falling asleep for your Mac. My current MacBook has 4 GB of RAM. Even coming straight from RAM, writing 4 GB of data to the hard drive is going to take a little while.
This also means that the computer is going to use up 4 GB of extra disk space on the drive.
But heres where it gets bad.
I boot other computers off my MacBook's hard drive regularly so I can run repair utilities on them etc. I booted a Mac Pro off my MacBook's hard drive. The MacPro had 8 GB of RAM. So when I found safe sleep ram storage file, it was 8 GB in size!
And of course, this whole system tends to not work great, causing LOTS of crashes when you close the lid.
And a little more on those crashes. What happens is the sleep light lights up, but doesn't pulse, it just stays lit. If you don't notice this and throw the computer in your bag, you're in for a surprise when you get home and remove the computer. When the computer crashes, it apparently runs the processors at full speed. The computer very quickly gets EXTREMELY hot. Putting it in a bag in this state can seriously shorten the lifespan of your Mac.
So weighing all this against the only drawback of disabling safe sleep, which is that if your battery dies completely while it's asleep, you'll lose unsaved documents as if you had done a hard reboot.... to me it's a no brainer, bye bye safe sleep.
So, To Disable Safe Sleep:
Type these two commands in the Terminal, and hit return:
sudo pmset -a hibernatemode 0
sudo nvram "use-nvramrc?"=false
Presto, instant fast sleep, and no more crashing!!
Now if you want to reclaim some hard drive space, an amount of space equal to the amount of RAM your computer has, do the following:
In the Finder, choose Go To Folder... from the Go menu
Type "/var/vm" into the prompt and hit return
Don't touch the swapfiles, they are important. But if there is a file in that folder called 'sleepimage', just drag it to the trash and you're good to go.