A method for repairing a main memory comprises the steps of: utilizing a spare memory to repair a main memory, wherein the spare memory includes a plurality of spare memory units; allocating a spare memory unit; determining whether available permutations of the allocated spare memory unit cover a newly found defect in the main memory; removing permutations of the spare memory unit failing to cover newly found defects in the main memory; and allocating another spare memory unit to repair the newly found defects if available permutations of the allocated spare memory unit fails to cover the newly found defects. |