In this theory, we are not aware of the full array of processing that occurs during REM sleep. While we dream the brain comes back on-line for a short period of time and the conscious mind is allowed to observe a small sample of the programs that are being run. The brain attempts to interpret this information in the same way it would during the wakeful state, what is created from these samples of information is a dream. In a nutshell, dreams are nothing more than a minute amount of the information that is being scanned and sorted during REM sleep. I agree with this one so far. - I has potentially explained bad dreams.
To deal with information overload, the brain needs a mechanism to debug and tune the network. This debugging mechanism would work best when the system was isolated from external inputs and it would have to have a way of randomly activating the network in order to eliminate spurious connections. This method, they say, is REM sleep and that the hallucinatory quality of dreams is nothing more than the random neural firing needed for the daily cleanup of the network.
According to this theory, these signals somehow erase the spurious memory associations formed during the previous day and we wake up with the network cleaned up. They believe that people remembering their dreams could help retain patterns of thought which are better forgotten, the same patterns that your system has attempted to clean out. This is why, they say, if you don't write down your dreams they will be forgotten because your brain is still working to clear these memories out.