It's a problem that comes up frequently, if you're a) a motorcyclist who's been riding for a long time, and b) a motorcyclist who wears a helmet when you ride.
Gear manufacturers tell us that we should replace our helmets roughly every 5 years or so, and it's not only because they want us to (of course) buy new ones. No matter what the shell of your helmet is made out of, the EPS foam layers inside degrade over time. Obviously, if you've crashed in your helmet, it needs to be replaced even sooner if it's going to effectively keep your head safe during the next off.
But what are you supposed to do with your old helmet if it isn't safe to wear anymore?