candydude357 said:
But would it be possible to sleep if your memory worked perfectly or would it interfere?
No, the idea of sleep is an alteration of how the brain is working. Your thalamic nuclei pay a large part in maintaining "wakefullness" and awareness. They accomplish this (the neurons in those nuclei) by firing in a tonic mode, which codes more specific sensorimotor information to higher cortical regions of the brain.
During sleep (slow wave sleep) the ascending reticular activating system that depolarizes thalamic neurons and is normally in a tonic firing state is suppressed which shifts thalamic nuclei to burst mode firing. In burst mode they are doing a kind of "sentinel vigilance"--Where lower processing centers of your brain can asses the information and dismiss it. Most of this information then, will have low salience (what gets your attention) and will not be stored in declarative memory systems. If your brain decides that information being received from burst mode neurons is more salient and requires your attention--The mode switches to tonic firing and thalamic nuclei involved in arousal wake you up. That information that was salient will be in your working memory (a special kind of short term memory) and possibly later consolidated into long term memory.
Say for instance you fell asleep on a train track and were awoken by the train horn. That sensory input (the horn) aroused you from sleep and is now in your working memory that allows you to make decisions and carry out planned motor function: Get off the train track. Likewise, you'd probably store that in long term memory such that in the future when you're looking for a place to sleep you don't lay down on a train track again.
candydude357 said:
Also what exactly causes sleepwalking?
Sleepwalking occurs in non-rem sleep. You actually wake up out of slow wave sleep (non-REM sleep), but those thalamic nuclei aren't fully aroused. You're in a "low state" of consciousness. Even in a "low state", your activity is still driven by processing centers in your brain without your direct awareness so you carry out functions without "knowing" it. Like cooking, cleaning, or even having sex with people!
Because many of your ascending systems still operate in burst mode, you're not getting conscious sensorimotor (tonic) coding. So much of the events that happen while sleepwalking go unremembered.
Or in laymen's terms--You don't fully wake up and your brain is just working on autopilot.