Patent ID: 7139863

Claim:
A method for managing data in a memory device having a plurality of blocks, comprising the steps of: maintaining a first vector having block entries sorted in order of number of overall block modifications for each block of the plurality of blocks; maintaining a second vector having block entries sorted in order of number of block modifications since a previous wear-leveling event; using the first vector and the second vector to determine which of the plurality of blocks should have its associated data relocated to another block; wherein the using step comprises the steps of: (i) determining which of a first given block associated with an entry in the first vector and a second given block associated with an entry in the second vector is more physically worn; (ii) determining which of the first given block and the second given block is more active; (iii) if either one of the first given block and the second given block are both the more physically worn block and the more active block, updating a swap table to indicate that contents of the first given block should be swapped with contents of the second given block; (iv) repeating steps (i)–(iii) for each block entry in at least the first vector; (v) re-sorting the second vector such that the blocks associated with the block entries contained therein are sorted in order of number of block modifications since a previous wear-leveling event; (vi) repeating steps (i)–(iv) for the re-sorted second vector; (vii) swapping blocks according to the swap table; and wherein in step (v) the second vector is sorted in reverse order from the order in which it was originally sorted in and, in addition, the first vector is also re-sorted in reverse order from the order in which it was originally sorted in.