Address rather than value of a ptr

    unsafe { &mut *(&mut self.ptr as *mut u64 as *mut Obj) }

Please correct me if I am wrong, in the above code, we do not care about what self.ptr is pointing to. We are taking the address of self.ptr (which also happens to be the last field of a struct in a mmaped region of memory), and interpreting it as the start of an struct Obj ?

Context: reading some database code.

Correct. In fact, based on this code, it looks like self.ptr isn't even a pointer, but a u64.

2 Likes

Yes, you're right.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.