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
impl Clone for JitAllocatorOptions
Source§fn clone(&self) -> JitAllocatorOptions
fn clone(&self) -> JitAllocatorOptions
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more