Struct MemoryManagement

Source
pub struct MemoryManagement<Storage> { /* private fields */ }
Expand description

Reserves and keeps track of chunks of memory in the storage, and slices upon these chunks.

Implementations§

Source§

impl<Storage: ComputeStorage> MemoryManagement<Storage>

Source

pub fn from_configuration( storage: Storage, properties: &MemoryDeviceProperties, config: MemoryConfiguration, ) -> Self

Creates the options from device limits.

Source

pub fn cleanup(&mut self, explicit: bool)

Cleanup allocations in pools that are deemed unnecessary.

Source

pub fn get(&mut self, binding: SliceBinding) -> Option<StorageHandle>

Returns the storage from the specified binding

Source

pub fn get_resource( &mut self, binding: SliceBinding, offset_start: Option<u64>, offset_end: Option<u64>, ) -> Option<Storage::Resource>

Returns the resource from the storage at the specified handle

Source

pub fn reserve( &mut self, size: u64, exclude: Option<&StorageExclude>, ) -> SliceHandle

Finds a spot in memory for a resource with the given size in bytes, and returns a handle to it

Source

pub fn storage(&mut self) -> &mut Storage

Fetch the storage used by the memory manager.

§Notes

The storage should probably not be used for allocations since the handles won’t be compatible with the ones provided by the current trait. Prefer using the alloc and dealloc functions.

This is useful if you need to time the deallocations based on async computation, or to change the mode of storage for different reasons.

Source

pub fn memory_usage(&self) -> MemoryUsage

Get the current memory usage.

Source

pub fn print_memory_usage(&self)

Print out a report of the current memory usage.

Trait Implementations§

Source§

impl<Storage> Debug for MemoryManagement<Storage>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Storage> Freeze for MemoryManagement<Storage>
where Storage: Freeze,

§

impl<Storage> RefUnwindSafe for MemoryManagement<Storage>
where Storage: RefUnwindSafe,

§

impl<Storage> Send for MemoryManagement<Storage>
where Storage: Send,

§

impl<Storage> Sync for MemoryManagement<Storage>
where Storage: Sync,

§

impl<Storage> Unpin for MemoryManagement<Storage>
where Storage: Unpin,

§

impl<Storage> UnwindSafe for MemoryManagement<Storage>
where Storage: UnwindSafe,

Blanket Implementations§

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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V