Type Definition jemallocator::ffi::extent_alloc_t

source ·
pub type extent_alloc_t = unsafe extern "C" fn(_: *mut extent_hooks_s, _: *mut c_void, _: usize, _: usize, _: *mut i32, _: *mut i32, _: u32) -> *mut c_void;
Expand description

Extent allocation function.

On success returns a pointer to size bytes of mapped memory on behalf of arena arena_ind such that the extent’s base address is a multiple of alignment, as well as setting *zero to indicate whether the extent is zeroed and *commit to indicate whether the extent is committed.

Zeroing is mandatory if *zero is true upon function entry. Committing is mandatory if *commit is true upon function entry. If new_addr is not null, the returned pointer must be new_addr on success or null on error.

Committed memory may be committed in absolute terms as on a system that does not overcommit, or in implicit terms as on a system that overcommits and satisfies physical memory needs on demand via soft page faults. Note that replacing the default extent allocation function makes the arena’s arena.<i>.dss setting irrelevant.

Errors

On error the function returns null and leaves *zero and *commit unmodified.

Safety

The behavior is undefined if:

  • the size parameter is not a multiple of the page size
  • the alignment parameter is not a power of two at least as large as the page size