Struct JitAllocatorOptions

Source
pub struct JitAllocatorOptions {
    pub use_dual_mapping: bool,
    pub use_multiple_pools: bool,
    pub fill_unused_memory: bool,
    pub immediate_release: bool,
    pub custom_fill_pattern: Option<u32>,
    pub block_size: u32,
    pub granularity: u32,
}

Fields§

§use_dual_mapping: bool

Enables the use of an anonymous memory-mapped memory that is mapped into two buffers having a different pointer. The first buffer has read and execute permissions and the second buffer has read+write permissions.

See alloc_dual_mapping for more details about this feature.

§Remarks

Dual mapping would be automatically turned on by JitAllocator in case of hardened runtime that enforces W^X policy, so specifying this flag is essentually forcing to use dual mapped pages even when RWX pages can be allocated and dual mapping is not necessary.

§use_multiple_pools: bool

Enables the use of multiple pools with increasing granularity instead of a single pool. This flag would enable 3 internal pools in total having 64, 128, and 256 bytes granularity.

This feature is only recommended for users that generate a lot of code and would like to minimize the overhead of JitAllocator itself by having blocks of different allocation granularities. Using this feature only for few allocations won’t pay off as the allocator may need to create more blocks initially before it can take the advantage of variable block granularity.

§fill_unused_memory: bool

Always fill reserved memory by a fill-pattern.

Causes a new block to be cleared by the fill pattern and freshly released memory to be cleared before making it ready for another use.

§immediate_release: bool

When this flag is set the allocator would immediately release unused blocks during release() or reset(). When this flag is not set the allocator would keep one empty block in each pool to prevent excessive virtual memory allocations and deallocations in border cases, which involve constantly allocating and deallocating a single block caused by repetitive calling alloc() and release() when the allocator has either no blocks or have all blocks fully occupied.

§custom_fill_pattern: Option<u32>§block_size: u32§granularity: u32

Trait Implementations§

Source§

impl Clone for JitAllocatorOptions

Source§

fn clone(&self) -> JitAllocatorOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JitAllocatorOptions

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for JitAllocatorOptions

Source§

fn default() -> Self

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

impl PartialEq for JitAllocatorOptions

Source§

fn eq(&self, other: &JitAllocatorOptions) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for JitAllocatorOptions

Source§

impl Eq for JitAllocatorOptions

Source§

impl StructuralPartialEq for JitAllocatorOptions

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.