The usual method for memorizing a piece of music consists of breaking that piece down into smaller easily managed parts and basically pounding them into our muscle memory and burning them into our mind with a dreadful amount of repetition. Unfortunately, this method yields mixed results for most players. Mostly because muscle memory is a very unreliable form of memorization. Many people, especially students and amateurs find that in the heat of the performing moment the have a slip of memory of a brief moment of uncertainty.
What I want to talk about is a method of practicing which I will refer to as integrative retention. What this refers to is the idea that while learning a piece or a lick or a chord progression we should not rely completely on our muscle memory and our mind. Rather, we should use a process of utilizing our voice our mind our muscle memory and our bodies. Here is an idea of what that might look like.
Take a simple l;ick for example. Start by playing the lick on your instrument. Then sing the lick while playing, then sing the lick accapella. Now sing the lick while playing the chords underneath which can be applied to it. Now take a walk. Choose a walking speed which can be applied to a possible tempo that you might take that lick at (you could make your steps be 8th notes if you want to play the lick more quickly) While you are walking sing the lick in cadence with your steps, try different rhythmic inflections, try to transpose the link or reverse it. Etc.