摘要 |
<p>Embodiments of the present invention provide a memory reclamation method and apparatus. The memory reclamation method includes: receiving a memory reclamation request message, where the memory reclamation request message includes a reclamation identifier, and the reclamation identifier is used to indicate a quantity of memory pages requested to be reclaimed; and reclaiming inactive memory pages of an NVM according to the reclamation identifier in ascending order of the write times of inactive memory pages of the non-volatile memory NVM. According to the memory reclamation method and apparatus in the embodiments of the present invention, inactive memory pages of an NVM are reclaimed in ascending order of the write times of inactive memory pages of the NVM, so that a page having a relatively small quantity of inactive memory page write times of the NVM is reclaimed first, and a page having a relatively large quantity of inactive memory page write times of the NVM is reclaimed later. Therefore, wear leveling of the NVM is achieved, and the stability and reliability of a storage unit is improved.</p> |