Skip to main content

AllocationReclamation

Struct AllocationReclamation 

Source
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

Source

pub fn attach_resource( &self, accounting: Arc<AllocationAccounting>, bytes: usize, ) -> ResourceResult<()>

Bind the backend’s exact accounting domain before calling malloc.

Source

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.

Source

pub fn was_acquired(&self) -> bool

Remains true after release, so an outer error/unwind cannot refund twice.

Source

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.

Trait Implementations§

Source§

impl Default for AllocationReclamation

Source§

fn default() -> AllocationReclamation

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.