Sorry you're concerned and I agree you should speak with your doctor about this ((Beholden)). Has your memory declined since the start of the medication? Is there any family history of dementia or Alzheimer's? In the meantime it would be good to take some Omega 3 and get a good book on nutrition/ brain functioning. There's brain exercises online and doing things like Suduko is good. Switching things up like trying to write with your opposite hand or any task with your opposite hand is good. Writing backwards also exercises your brain. Learning something new - musical instrument or language also builds new brain connections.
Meditation also clears the mind and helps us handle stress better. On PBS they have shows on Brain Plasticity and I recommend getting one of those books. I hope you find the reason and solution to feel better.