I’m 24 and been noticing decreasing memory as well. I constantly forget what I have done during standup in the morning and can’t think of location of code when asked about it..etc
For my case it’s definitely due to lack of sleep which is caused by consuming great amount of caffeine for my workout every other day. I’m considering dropping pre-workout but I just can’t control myself eating junk food!