Patent ID: 7096313

Claim:
A method for processing elements included in a non-volatile memory of a memory system, each element having an associated erase count, the method comprising: identifying a first set of erased elements, wherein the erased elements included in the first set of erased elements are less worn than erased elements not included in the first set of erased elements, by identifying a number of erased elements for which the associated erase counts are relatively low and grouping the identified erased elements into the first set; placing entries associated with the first set of elements into a data structure; sorting the entries within the data structure; and identifying a first element within the first set of elements using the sorted entries, wherein the first element is less worn than other elements included in the first set of elements; determining when a second element not included in the first set is to be erased; removing the first element from the first set when it is determined that the second element is to be erased; copying one of contents of the second element and new contents to replace the contents of the second element into the first element; erasing the contents from the second element; and adding the second element to the first set.