[][src]Type Definition jemalloc_sys::extent_alloc_t

type extent_alloc_t = unsafe extern "C" fn(extent_hooks: *mut extent_hooks_t, new_addr: *mut c_void, size: size_t, alignment: size_t, zero: *mut c_int, commit: *mut c_int, arena_ind: c_uint) -> *mut c_void;

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