pub struct AllocationReclamation { /* private fields */ }Expand description
Accounting owned by one allocation attempt and then by its physical storage.
Resource implementations bind their accounting before malloc, call
Self::acquired immediately after arming the returned pointer, and retain
this owner until Self::confirm_physical_release settles physical release.
Refusal and unwind guards use the persistent acquisition proof, not the
shape of an error or whether a concurrent reaper already freed the storage.
Implementations§
Source§impl AllocationReclamation
impl AllocationReclamation
Sourcepub fn attach_resource(
&self,
accounting: Arc<AllocationAccounting>,
bytes: usize,
) -> ResourceResult<()>
pub fn attach_resource( &self, accounting: Arc<AllocationAccounting>, bytes: usize, ) -> ResourceResult<()>
Bind the backend’s exact accounting domain before calling malloc.
Sourcepub fn acquired(&self) -> ResourceResult<()>
pub fn acquired(&self) -> ResourceResult<()>
Publish acquisition after the real pointer has an armed storage owner. Even an accounting error means storage exists: it must be retained for physical cleanup, never reported as a definite malloc refusal.
Sourcepub fn was_acquired(&self) -> bool
pub fn was_acquired(&self) -> bool
Remains true after release, so an outer error/unwind cannot refund twice.
Sourcepub unsafe fn confirm_physical_release(&self) -> ResourceResult<()>
pub unsafe fn confirm_physical_release(&self) -> ResourceResult<()>
Called only after the raw owner proves physical free. Accounting failure retains the exact charge for retry; no CUDA wait runs under this mutex.
§Safety
The exact allocation must have been physically freed after every device use completed. Keep its owner and this ticket until settlement succeeds. Publishing this proof for live storage can invalidate access exclusion.