Memory allocation and reference linking (storing the value of the allocated space’s pointer into the reference) are two separate operations that cannot be implemented with a single atomic instruction. Thus, there is a persistent memory leak if the allocation is done but the linking is not. In the other case, if the linking is done but the allocation is not, there is a wild pointer problem. Partial Failure Resilient Memory Management System for (CXL-based) Distributed Shared Memory

类似PMDK的内存分配机制通常是保证先分配。为了解决可能的泄漏,在系统初始化(比如从崩溃中恢复)时,都会对整个PMEM扫描一遍,回收泄漏的资源。

和传统的垃圾回收类似,可达性需要从某些引用出发进行计算,但是崩溃后易失性内存状态丢失(故引用也丢失),只能在持久内存上进行分析。因此通常PMEM都有一个「root」:

To solve this problem, persistent memory allocators typically provide a setRoot() function for users to indicate that an object is a root object. Root objects are recorded in special locations that can still be found after a failure, and hence pmem allocators can perform garbage collection to reclaim spaces that are not linked from any root object. Partial Failure Resilient Memory Management System for (CXL-based) Distributed Shared Memory

类似GC,这使得在初始化时需要有较长时间的回收阶段(而且因为持久内存普遍比易失性内存容量大,延迟更加明显,可达数十秒)

上述机制均假设failure model为full system failure