According to materialistic science any memory requires a material substrate such as the neuronal network in the brain or the DNA molecules of the genes.
We sleep but the loom of life never stops and the pattern which was weaving when the sun went down is weaving when it comes up in the morning.