Exercise may help the brain to build durable memories, through good times and bad.

Stress and adversity weaken the brain’s ability to learn and retain information, earlier research has found. But according to a remarkable new neurological study in mice, regular exercise can counteract those effects by bolstering communication between brain cells.

Memory has long been considered a biological enigma, a medley of mental ephemera that has some basis in material existence. Memories are coded into brain cells in the hippocampus, the brain’s memory center. If our memories were not written into those cells, they would not be available for later, long-term recall, and every brain would be like that of Dory, the memory-challenged fish in “Finding Nemo.”

But representations of experience are extremely complex, and aspects of most memories must be spread across multiple brain cells, neuroscientists have determined.

These cells must be able to connect with one another, so that the memory, as a whole, stays intact.

The connections between neurons, known as synapses, are composed of electrical and chemical signals that move from cell to cell, like notes passed in class. The signals can be relatively weak and sporadic or flow with vigor and frequency. In general, the stronger the messages between neurons, the sturdier and more permanent the memories they hold.