how to protect memory