The 1st Chabad Rebbe, Rabbi Shneur Zalman of Liadi, explained concerning learning Torah by-heart:[1]
If an individual desires that the Holy One, blessed be He, reside constantly within the person—even when involved in corporeal matters—he should engrave the words of Torah in his memory. For, as the Zohar (2:90b) explains: “The Torah and the Holy One, blessed be here, are one.”
[1] Likutei Torah, Kedoshim 30d