It’s weird how I’ll see a dream and really ponder over it right after waking only for it to be completely out of my memory shortly after.
You don’t form longterm memories while asleep; you lose the last few minutes before you drop off, as well. Short-term memories are held, but they don’t get stored.
And the same applies while you’re dreaming - nothing’s getting recorded. You can pull it out of short-term right after you wake up, but that fades right out.
When you do remember dreams, it’s because you remember remembering them while you were awake. If it was vivid enough to go over hard enough, then the second-hand memory gets stored.
Basically when you sleep only RAM works and no ROM storage is active, when you wake up ROM comes online, if you don’t pull data from RAM fast, it will be overwritten by other things and you lose it forever.
What about recurring dreams though? I’ve had some dreams where the most notable part was that it was a location that only existed in my dreams but I’d been there before in previous dreams. Wouldn’t you need some kind of recollection to notice that?
There’s a few logical possibilities here.
#1 is that whatever stimuli produced it the first time keeps producing it later.
#2 is that you clearly did remember them enough, possibly when you woke up, to commit it to long term memory. This is a tautology, because you would have to remember it to know that it was in previous dreams.
#3, as someone mentioned below, is your mind playing tricks on you. Ever had a dream where you knew an object was something important and specific, even though its appearance in the dream was clearly not that? E.g. you know you’re at your (specific) friend’s house, but that’s not at all what their house looks like. Dreams have a lot of weird substitutions like this, including the idea that you’ve been somewhere before
Dreams don’t really make any sense. When you wake up, you’re remembering the emotions and linking them with images, but as the feelings fade, unless you were actively making them into a narrative, the random stimulus soup doesn’t have any staying power worth remembering. Trying to remember just corrupts your working memory and will make you change and add details that weren’t there. Same reason eye witness testimony is very often wrong.
As with most brain questions, nobody knows exactly.
One theory for the purpose of it, is to prevent us from confusing things we dreamed about with things that actually happened.
Edit: Lol, this always gets downvoted, but it’s the truth. We know nothing about the brain; almost all the studies that get reported on are basically this.