(heap: *Heap, memory: *void) -> bool
#import "rpmalloc";
Module parameters#
- HEAP_ARRAY_SIZE := 47
- The size of the table of heaps that threads share.
- DEFAULT_SPAN_MAP_COUNT := 64
- How many spans are mapped at a time.
- GLOBAL_CACHE_MULTIPLIER := 8
- How many times larger the global cache is than a thread cache.
- ENABLE_THREAD_CACHE := true
- Keeps freed spans in a cache for each thread.
- ENABLE_GLOBAL_CACHE := true
- Keeps freed spans in a cache that threads share. Needs the thread cache.
- ENABLE_STATISTICS := true
- Counts allocations and mapped memory for the statistics procedures.
- ENABLE_ASSERTS := true
- Checks the allocator's internal invariants.
- ENABLE_VALIDATE_ARGS := true
- Checks the arguments of its procedures.
- LINUX_FREE_ADVICE: enum { DONTNEED; FREE; } = .DONTNEED
- The advice given to Linux when pages are freed.
- CONFIGURABLE := false
- Lets the allocator be configured when it is initialized.
- ENABLE_ADAPTIVE_THREAD_CACHE := false
- Sizes each thread's cache from how the thread allocates. Needs the thread cache.
- LINUX_HUGE_PAGES := false
- Asks Linux for transparent huge pages.
- USE_RAW := false
- Binds the C interface with
size_tand the C types as the header writes them, nots64. - DISABLE_UNMAP := false
- Never returns memory to the OS. Needs the global and unlimited caches.
- ENABLE_UNLIMITED_CACHE := false
- Lets the caches grow without a limit. Needs the global cache.
Procedures#
Wrappers#
(memory: *void, span: *Span) -> bool
(size: s64) -> *void
(size: size_t) -> *void
(ptr: *void)
(ptr: *void)
(ptr: *void, size: s64) -> *void
(ptr: *void, size: size_t) -> *void
(alignment: s64, size: s64) -> *void
(alignment: size_t, size: size_t) -> *void
() -> *rpmalloc_heap_t
(heap: *rpmalloc_heap_t)
(heap: *rpmalloc_heap_t, size: size_t) -> *void
(heap: *rpmalloc_heap_t, alignment: size_t, size: size_t) -> *void
(heap: *rpmalloc_heap_t, num: size_t, size: size_t) -> *void
(heap: *rpmalloc_heap_t, alignment: size_t, num: size_t, size: size_t) -> *void
(heap: *rpmalloc_heap_t, ptr: *void, alignment: size_t, size: size_t, flags: Realloc_Flags) -> *void
(heap: *rpmalloc_heap_t, ptr: *void)
(heap: *rpmalloc_heap_t)
(heap: *rpmalloc_heap_t)
() -> _int
(config: *rpmalloc_config_t) -> _int
()
() -> bool
() -> *rpmalloc_config_t
()
()
(release_caches: bool)
(release_caches: _int)
() -> bool
(ptr: *void) -> size_t
(stats: *rpmalloc_global_statistics_t)
(stats: *rpmalloc_thread_statistics_t)
(num: size_t, size: size_t) -> *void
(alignment: size_t, num: size_t, size: size_t) -> *void
(alignment: size_t, size: size_t) -> *void
(memptr: **void, alignment: size_t, size: size_t) -> _int
()
(file: *void)
()
Allocator#
(mode: Allocator_Mode, requested_size: s64, old_size: s64, old_memory: *void, allocator_data: *void) -> *void
Types#
:: enum_flags
- NO_PRESERVE
- GROW_OR_FAIL
:: struct
- memory_map: #type (size: s64, offset: *s64) -> *void
- memory_unmap: #type (address: *void, size: s64, offset: s64, release: s64) -> ()
- error_callback: #type (message: string, location: Source_Code_Location) -> ()
- map_fail_callback: #type (size: s64) -> s32
- page_size: s64
- span_size: s64
- span_map_count: s64
- enable_huge_pages: bool
- page_name: string
- huge_page_name: string
:: struct
- mapped: s64
- mapped_peak: s64
- cached: s64
- huge_alloc: s64
- huge_alloc_peak: s64
- mapped_total: s64
- unmapped_total: s64
:: struct
- sizecache: s64
- spancache: s64
- thread_to_global: s64
- global_to_thread: s64
- span_use: [64] struct { current: s64; peak: s64; to_global: s64; from_global: s64; to_cache: s64; from_cache: s64; to_reserved: s64; from_reserved: s64; map_calls: s64; }
- size_use: [128] struct { alloc_current: s64; alloc_peak: s64; alloc_total: s64; free_total: s64; spans_to_cache: s64; spans_from_cache: s64; spans_from_reserved: s64; map_calls: s64; }
Constants#
:: false
:: heap_t
:: CONFIGURABLE
:: heap_t