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.
I get a lot of the ideas when I'm resting - either when I'm meditating or getting some kind of work done on my back like physical therapy or acupuncture. That's where I get my best ideas maybe because I'm balancing my body.