The reference to memory involves the purification of the imagination, which I have written into the perfection series.
First of all, stop putting things into your imagination which are evil. Remember, things are either good or bad, there is no neutral in the spiritual life.
Second, use custody of the eyes and ears.
Third, control curiosity and see my posts on this and some reposts.
Fourth, ask God to enter into your memory to purify it and take away images. Images are used by demons to tempt us and remind us of past sins.
Today's Gospel refers to not even committing venial sins, which also feed our imagination as well.