There is no need to get too worried about slight discolouration of your memory foam mattress as this is part of the aging process and in no way affects the performance. The foam oxidises as it ages, cause the foam to change colour, but the memory foam maintains its capabilities.
It does pay to check your mattress at least twice a year though, rotating it and letting it air for a day on its side. During this routine assessment, you should look over your mattress for any dampness or stains. Making sure that your mattress is not getting damp underneath is critical as once it is damp it will not dry and mould will develop. To ensure that you get a long and fulfilling lifespan from your mattress, you need to develop a routine of rotating and airing your mattress.
Naturally, if there is serious discolouration or vastly uneven discolouration, then you may need to replace your mattress as this has probably been caused by some form of mould or an incident. The problem is that if your mattress has mould on it this can become a health issue for you. If you have allergies, they will flare up, and it may cause breathing trouble for many people.