I'm reminded of Harry Potter and the Methods of Rationality, and Dr Who and the Silence.
If you are in a place where quick memory removal or alteration takes place, and you think you're about to have your memory wiped, take an action that hurts you in a specific place, so after you have had parts of your memory erased, you can be aware that someone is screwing with you. Jab your fingernails into your palm, bite on one specific part of your tongue, something that you would remember about.
It won't help if you're caught by surprise or unawares, and won't help if it totally wipes you out, but at least it gives you a slim chance to be aware.