Hi dear first of all remove all the myth from your mind about Masturbation
Masturbation is totally normal phenomena & it has got nothing to do with loss of memory.
So...don't worry & concentrate on your studies.
If you are not able to concentrate or remember things, better try doing meditation
..it helps a lot.
Other than that eat a healthy diet, stay active, exercise regularly, avoid stress
, get good sleep, think positive and stay happy.
Best wishes for your exams.