Integrated analysis of the interplay between memory and energy metabolism