No one knows what purposes, if any, dreams serve, although there are a number of hypotheses  According to one hypothesis, dreams are produced when the brain is erasing parasitic connections (meaningless, accidental associations between ideas), which accumulate during the day and which would otherwise clog up our memories  Interestingly, the only mammal that does not have rapid eye movement sleep, in which we humans typically have our most vivid dreams, is the spiny anteater, which has been seen as anomalous in that it has a very large brain relative to the animal' s size
This fact provides some confirmation for the parasitic-connection hypothesis, since the hypothesis predicts that for an animal that did not dream to have an effective memory that animal would need extra memory space for the parasitic connections
Insofar as a person's description of a dream involves meaningful associations between ideas, it is an inaccurate description.