I will give you what understanding I have, which is based on suttas and personal observation. It is worth noting, however, that Buddhism is concerned with how things appear from the 'inside', but doesn't talk to much on the nittygritty biology involved. It is important to note that the mechanical of memory is in the brain and nervous system. Where else would it be?
When I look at an object, I immediately take in a large number of attributes about said object. This is an act of the eye, the object being sensed by the eye, and the necessary consciousness being aware of that input from the eye, all coming together (this is termed 'contact'). From contact it is said that feeling arises, then craving, then clinging, then becoming. In the description of something called dependent co-arising each event is said to be conditioned by the previous one, ie without the previous event having occurred, the current step does not happen. However, there is no mention of perception in this chain, nor memory.
However, there is a passage linking feeling with consciousness and perception. In addition there is a kind of definition of what a perception is. Take a look, and continue reading my post below.http://www.accesstoinsight.org/tipitaka ... .than.html
"'Perception, perception': Thus is it said. To what extent, friend, is it said to be 'perception'?"
"'It perceives, it perceives': Thus, friend, it is said to be 'perception.' And what does it perceive? It perceives blue. It perceives yellow. It perceives red. It perceives white. 'It perceives, it perceives': Thus it is said to be 'perception.'"
"Feeling, perception, & consciousness, friend: Are these qualities conjoined or disjoined? Is it possible, having separated them one from another, to delineate the difference among them?"
"Feeling, perception, & consciousness are conjoined, friend, not disjoined. It is not possible, having separated them one from another, to delineate the difference among them. For what one feels, that one perceives. What one perceives, that one cognizes. Therefore these qualities are conjoined, not disjoined, and it is not possible, having separated them one from another, to delineate the difference among them."
Now I ask you: how come you can discern between blue and red? Is there a way that you might, at this point in your life, call the color red 'blue'? When and how did you learn your colors.
This is how perception is a part of memory, in that perceptions are 'labels' or construct that exist in our being which grew out of repeated 'contact' (see above) with the outer world coupled with the internal thought processes that organized them. They can be simple, as in color, or complex, as in a recollection of a parent. In more complex perceptions there is a spreading out, as a interconnect web, as it were, of smaller perceptions which describe the complex perception. Each smaller perception could in turn be linked to another complex perception, which produces a huge net of interdependent labels for things taken in by the senses.
So when new input is taken in via the senses, it too receives the same rough treatment, with the thought process seeking out pre-existing perceptions in the mind that are the same or similar to those attributes that have been taken in via the sense. When a perception is found, there is a very likely possibility that an active mind will seek out other perceptions related to it, in an attempt to give sense data more context for the purpose of taking an action, and this in turn pulls more and more previous experience into the present experience.
As an example, as really silly one, is this from my life: I picked up a valentine heart cut out by my kid, and noted that the top (the humps) were uneven in size. Then I noted a similarity between the 'humps' and breasts (its true, I did)... before I knew it there was an unfolding of memories, which ended up with me recollecting a scene from "American beauty" where the main character stood in front of a window with her shirt off, and her breasts are uneven. Where did that come from, I would have wondered, had I not been observant. If I had not stopped the process, what would I have ended up recalling to mind?
Anyway, my eyes are bugged. I don't know if this answer is useful to you or in the vein you were looking for, but ask any questions about it that you like, and I will do my best to answer.