[][src]Trait context_allocator::memory_sources::MemorySource

pub trait MemorySource: Debug {
    fn obtain(
        &self,
        non_zero_size: NonZeroUsize
    ) -> Result<MemoryAddress, AllocErr>;
fn release(
        &self,
        non_zero_size: NonZeroUsize,
        current_memory: MemoryAddress
    ); }

A memory source is a sort-of crude allocator that can obtain and release memory, from, say, the operating system, an arena or some fixed range.

It is thread-aware but not necessarily thread-safe.

Required methods

fn obtain(&self, non_zero_size: NonZeroUsize) -> Result<MemoryAddress, AllocErr>

Obtain memory from the operating system, say.

Alignment will be whatever is appropriate, but is likely to be quite large.

fn release(&self, non_zero_size: NonZeroUsize, current_memory: MemoryAddress)

Release memory to the operating system, say.

Alignment will be whatever is appropriate, but is likely to be quite large.

Loading content...

Implementors

impl MemorySource for MemoryMapSource[src]

impl<MS: MemorySource> MemorySource for ArenaMemorySource<MS>[src]

impl<MS: MemorySource> MemorySource for RcMemorySource<MS>[src]

Loading content...