MacBook – When resuming from hibernate, weird garbage on screen

hibernatemacbook pro

For some reason, when returning from an hibernate after i.e. battery drops to 0%, I get this:

Glitches on Mac screen

Mind that this only happens with a few programs, and reopening them works most of the time, and a full reboot fully solves the issue.

It's a Early 2011 Macbook Pro 13'' (Base model), with RAM upgraded to 8GB 1867mhz and 128GB SSD, running Lion 10.7.3.

Edit:

~ ‹›  $ pmset -g
Active Profiles:
Battery Power       -1*
AC Power        -1
Currently in use:
 standbydelay   4200
 standby    0
 halfdim    1
 sms        0
 panicrestart   157680000
 hibernatefile  /var/vm/sleepimage
 disksleep  0
 sleep      10
 hibernatemode  0
 ttyskeepawake  1
 displaysleep   2
 acwake     0
 lidwake    0
~ ‹›  $ 

Best Answer

By default, the MacBook actually copies its RAM to disk any time it enters sleep mode (called Safe Sleep). You'll notice this because when you close the lid on your MacBook, there will be a few seconds before the light on the front starts flashing. When the battery gets to 0%, all the computer needs to do is power-off, since the RAM state has already been saved.

This makes me wonder if the problem is happening anytime you return from sleep, or only when the battery hits 0%.

I had similar issues on my MacBook, where the laptop wouldn't return properly from sleep mode. These have gone away for me since disabling hibernate and disabling lid wake.

Many people with SSD disks choose to disable hibernate as the process of Safe Sleep causes a lot of extra writing to the disk (and SSDs have a limited writable lifespan). Since you've upgraded to 8 GB, the laptop is writing 8 GB to disk each time you close the lid.

Note that disabling hibernate will also let your laptop enter sleep mode instantly when you close the lid (something I really like). You'll also recover 8 GB from the sleepimage file, which is pretty valuable on a 128 GB drive.

The only concern is that disabling hibernate will be a problem for you if you actually do hit 0% battery frequently. In this case, it will be as if the laptop had been powered off (crashed). That's not the end of the world, but you will lose any unsaved documents you may have been working on. The solution: don't let your laptop get to 0% battery and shutdown the MacBook when you know it will be off for an extended period of time.

Disabling lid wake prevents the laptop from returning from sleep until you hit any key. I believe this is what actually solved my display issues, but I'm not sure since I did both.

In any case, here's what I suggest for people with an SSD:

sudo pmset -a hibernatemode 0
sudo pmset -a disksleep 0
sudo pmset -a lidwake 0
sudo rm /var/vm/sleepimage

Confirm the settings with sudo pmset -g.

You can find more tips to optimize your MacBook for your SSD here: http://sysadmin.flakshack.com/post/9253439680/ssd-tweaks-for-mac-os-x