Why we need sleep to remember

Lack of sleep makes it difficult for us to function well during the day.
It also makes it much harder for us to learn new material.
Whilst it has been known that sleep and memory are closely intertwined, the physical mechanism underlying this has been poorly understood until recently.

When we sleep, our brain is working very hard replaying the information we learned during the time we were awake. This occurs during our deep slow wave sleep.

New mice studies have shown how within 6 hours of learning a new skill, new dendritic spines develop along the branches of dendrites of our neurons, like buds sprouting on a tree branch in Spring. These new dendrites can then form new synaptic connections with other neurons.

So, where does sleep come into this? It appears that deep slow wave sleep enables this process. Conversely, being sleep deprived or staying awake after learning diminishes the amount of dendrite growth.

If you've got lots to learn, this is even more reason to ensure you get enough sleep to facilitate long term memory. Plus going to sleep shortly after the learning phase appears to be best.

Not only that it turns out the type of learning leads to dendritic growth on different branches of neurons indicating that learning causes very specific structural changes in the brain.

Wen-Biao Gan et al.  Sleep promotes branch-specific formation of dendritic spines after learning. Science 6 June 2014: Vol. 344 no. 6188 pp. 1173-1178 DOI:10.1126/science.1249098