kerla icon indicating copy to clipboard operation
kerla copied to clipboard

Add lifetime to `PAddr` and `VAddr`

Open nuta opened this issue 3 years ago • 0 comments

In #141, I noticed that we need to track the lifetime of a PAddr object which references to OwnedPages. It's problematic because it lead to memory leaks or nasty use-after-free bugs. In this issue, I'll replace PAddr and VAddr as:

#[repr(transparent)]
pub struct PAddr<'a> {
    value: usize,
    _pd: PhantomData<&'a ()>,
}

nuta avatar Dec 22 '21 13:12 nuta