In Lilycove City, there is a girl that reads Pokemon memories. All my Pokemon had memories of battles or events that happened along the course of my gameplay. One Pokemon, traded to me by a friend who plays XY, says it remembers going on a train with her. I have one Pokemon, that says it cannot remember something, but it was a good memory. What determines what the Pokemons memory will be, and why do some Pokemon have forgotten memories?
Maybe, the Pokemon memory is based on previous experiences, Battles and events are displayed when you use the Pokemon in battles and train with it. When a Pokemon is traded, it will tell you everything/or some things it has been through. For Pokemon with no memories, it probably has never been used in the battle or won any matches. It seems like a Pokemon that you just catch for the pokedex.
Hope this helped! :)