do you detest those memories? then don't worry about it. once Jesus comes such memories remain in the ground, the only memory that is forever is God's. and what He sees in you that is of His Son is Beloved. so fyi the treasure in heaven is the Lord and what you benefit from is whatever that is of the Lord that is in you and the deeds of Him that He did with you.
when Jesus walked with His people:
Luk 4:13 And when the devil had ended all the temptation, he departed from him for a season.
therefore, even Jesus had to experience the devil's attempts to get Him to entertain what the Father wouldn't have Jesus to entertain. the flesh is condemned in the condemned condition. you may not be able to prevent a thought to come to mind, but you surly don't have to entertain it. no different then, some one could say something to get you to consider a thing, but you don't have to entertain it.