The divine soul itself is not subject to forgetfulness.
It is inextricably linked to the Torah in a very real and deeply powerful bond, and so it cannot forget.
The ability to forget something is a flaw that is rooted in materiality and kelippa.
When a person is attached to his materiality and the kelippa elements within him while studying a particular subject, it is possible that the material aspect will pay no heed to what he is studying, in which case he is liable to forget.
But when a person directs the energy of his animal soul into the letters of Torah and prayer, he thereby repairs and nullifies the kelippa of the animal soul, automatically resulting in his ability to retain those words in his memory.
Rabbi Adin Steinsaltz