Energy-efficient and cost-effective reliability design in memory systems