Detection or location of defective memory elements