Memory is a central characteristic of immune responses. It is defined as an elevated number of specific immune cells that remain after resolution of infection and can protect the host against reinfection. The evolution of immunological memory is subject to debate. The advantages of memory discussed so far include protection from reinfection, control of chronic infection, and the transfer of immune function to the next generation. Mathematical models are used to identify a new force that can drive the evolution of immunological memory: the duration of memory can regulate the degree of competition between different pathogens. While a long duration of memory provides lasting protection against reinfection, it may also allow an inferior pathogen species to persist. This can be detrimental for the host if the inferior pathogen is more virulent. On the other hand, a shorter duration of memory ensures that an inferior pathogen species is excluded. This can be beneficial for the host if the inferior pathogen is more virulent. Thus, while in the absence of pathogen diversity memory is always expected to evolve to a long duration, under specific circumstances, memory can evolve toward shorter durations in the presence of pathogen diversity.