It is true, that excess of anything is harmful. but it can not said that you forget things, is due to excess masturbation.
Masturbation is an artificial process to get physical pleasure, however it consumes lot of energy.
A healthy diet is suggested to overcome any weakness & take out from your mind that masturbation is the reason for your problem.
Live Healthy