Top Description Fields Constructors Methods
org.lwjgl.system.rpmalloc

public Class RPmalloc

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

Native bindings to the rpmalloc library. rpmalloc is a public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C.

You are required to call these functions from your own code in order to initialize and finalize the allocator in your process and threads:

Then simply use the malloc/free and the other malloc style replacement functions. Remember all allocations are 16-byte aligned, so no need to call the explicit memalign/aligned_alloc/posix_memalign functions unless you need greater alignment, they are simply wrappers to make it easier to replace in existing code.

The rpmalloc build in LWJGL is configured with RPMALLOC_CONFIGURABLE=1 and ENABLE_STATISTICS=0.

Field Summary

Modifier and TypeField and Description
public static final int
RPMALLOC_GROW_OR_FAIL

Flag to aligned_realloc to fail and return null pointer if grow cannot be done in-place, in which case the original pointer is still valid (just like a call to realloc which failes to allocate a new block).

public static final int
RPMALLOC_NO_PRESERVE

Flag to aligned_realloc to not preserve content in reallocation.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static native long
nrpaligned_alloc(long alignment, long size)

Unsafe version of: aligned_alloc

public static native long
nrpaligned_calloc(long alignment, long num, long size)

Unsafe version of: aligned_calloc

public static native long
nrpaligned_realloc(long ptr, long alignment, long size, long oldsize, int flags)

Unsafe version of: aligned_realloc

public static native long
nrpcalloc(long num, long size)

Unsafe version of: calloc

public static native void
nrpfree(long ptr)

Unsafe version of: free

public static native long
nrpmalloc(long size)

Unsafe version of: malloc

public static native long
nrpmalloc_config()

Unsafe version of: malloc_config

public static native long
public static native void
public static native long
nrpmalloc_heap_aligned_alloc(long heap, long alignment, long size)

Unsafe version of: malloc_heap_aligned_alloc

public static native long
nrpmalloc_heap_aligned_calloc(long heap, long alignment, long num, long size)

Unsafe version of: malloc_heap_aligned_calloc

public static native long
nrpmalloc_heap_aligned_realloc(long heap, long ptr, long alignment, long size, int flags)

Unsafe version of: malloc_heap_aligned_realloc

public static native long
nrpmalloc_heap_alloc(long heap, long size)

Unsafe version of: malloc_heap_alloc

public static native long
nrpmalloc_heap_calloc(long heap, long num, long size)

Unsafe version of: malloc_heap_calloc

public static native void
nrpmalloc_heap_free(long heap, long ptr)

Unsafe version of: malloc_heap_free

public static native void
nrpmalloc_heap_free_all(long heap)

Unsafe version of: malloc_heap_free_all

public static native long
nrpmalloc_heap_realloc(long heap, long ptr, long size, int flags)

Unsafe version of: malloc_heap_realloc

public static native int
public static native int
public static native int
public static native void
nrpmalloc_thread_finalize(int release_caches)

Unsafe version of: malloc_thread_finalize

public static native void
public static native long
nrpmalloc_usable_size(long ptr)

Unsafe version of: malloc_usable_size

public static native long
nrpmemalign(long alignment, long size)

Unsafe version of: memalign

public static native int
nrpposix_memalign(long memptr, long alignment, long size)

Unsafe version of: posix_memalign

public static native long
nrprealloc(long ptr, long size)

Unsafe version of: realloc

public static ByteBuffer
rpaligned_alloc(long alignment, long size)

Allocates a memory block of at least the given size and alignment.

pack-priv static native long
rpaligned_alloc_address()

The aligned_alloc function address.

public static ByteBuffer
rpaligned_calloc(long alignment, long num, long size)

Allocates a memory block of at least the given size and alignment, and zero initializes it.

public static ByteBuffer
rpaligned_realloc(ByteBuffer ptr, long alignment, long size, int flags)

Reallocates the given block to at least the given size and alignment, with optional control flags (see MALLOC_NO_PRESERVE).

public static ByteBuffer
rpcalloc(long num, long size)

Allocates a memory block of at least the given size and zero initializes it.

pack-priv static native long
rpcalloc_address()

The calloc function address.

public static void
rpfree(ByteBuffer ptr)

Frees the given memory block.

public static void
rpfree(ShortBuffer ptr)

Frees the given memory block.

public static void
rpfree(IntBuffer ptr)

Frees the given memory block.

public static void
rpfree(LongBuffer ptr)

Frees the given memory block.

public static void
rpfree(FloatBuffer ptr)

Frees the given memory block.

public static void
rpfree(DoubleBuffer ptr)

Frees the given memory block.

public static void
rpfree(PointerBuffer ptr)

Frees the given memory block.

pack-priv static native long
rpfree_address()

The free function address.

public static ByteBuffer
rpmalloc(long size)

Allocates a memory block of at least the given size.

pack-priv static native long
rpmalloc_address()

The malloc function address.

public static RPMallocConfig
rpmalloc_config()

Gets allocator configuration.

public static native void
rpmalloc_finalize()

Finalizes allocator.

public static long
rpmalloc_get_heap_for_ptr(ByteBuffer ptr)

Returns which heap the given pointer is allocated on.

public static long
rpmalloc_get_heap_for_ptr(ShortBuffer ptr)

Returns which heap the given pointer is allocated on.

public static long
rpmalloc_get_heap_for_ptr(IntBuffer ptr)

Returns which heap the given pointer is allocated on.

public static long
rpmalloc_get_heap_for_ptr(LongBuffer ptr)

Returns which heap the given pointer is allocated on.

public static long
rpmalloc_get_heap_for_ptr(FloatBuffer ptr)

Returns which heap the given pointer is allocated on.

public static long
rpmalloc_get_heap_for_ptr(DoubleBuffer ptr)

Returns which heap the given pointer is allocated on.

public static long
rpmalloc_get_heap_for_ptr(PointerBuffer ptr)

Returns which heap the given pointer is allocated on.

public static void
public static native long
rpmalloc_heap_acquire()

Acquires a new heap.

public static ByteBuffer
rpmalloc_heap_aligned_alloc(long heap, long alignment, long size)

Allocates a memory block of at least the given size using the given heap.

public static ByteBuffer
rpmalloc_heap_aligned_calloc(long heap, long alignment, long
'
num
,
long size)

Allocates a memory block of at least the given size using the given heap and zero initializes it.

public static ByteBuffer
rpmalloc_heap_aligned_realloc(long heap, ByteBuffer ptr, long alignment, long size, int flags)

Reallocates the given block to at least the given size.

public static ByteBuffer
rpmalloc_heap_alloc(long heap, long size)

Allocates a memory block of at least the given size using the given heap.

public static ByteBuffer
rpmalloc_heap_calloc(long heap, long num, long size)

Allocates a memory block of at least the given size using the given heap and zero initializes it.

public static void
rpmalloc_heap_free(long heap, ByteBuffer ptr)

Frees the given memory block from the given heap.

public static void
rpmalloc_heap_free(long heap, ShortBuffer ptr)

Frees the given memory block from the given heap.

public static void
rpmalloc_heap_free(long heap, IntBuffer ptr)

Frees the given memory block from the given heap.

public static void
rpmalloc_heap_free(long heap, LongBuffer ptr)

Frees the given memory block from the given heap.

public static void
rpmalloc_heap_free(long heap, FloatBuffer ptr)

Frees the given memory block from the given heap.

public static void
rpmalloc_heap_free(long heap, DoubleBuffer ptr)

Frees the given memory block from the given heap.

public static void
rpmalloc_heap_free(long heap, PointerBuffer ptr)

Frees the given memory block from the given heap.

public static void
rpmalloc_heap_free_all(long heap)

Frees all memory allocated by the heap.

public static ByteBuffer
rpmalloc_heap_realloc(long heap, ByteBuffer ptr, long size, int flags)

Reallocates the given block to at least the given size.

public static native void
rpmalloc_heap_release(long heap)

Releases a heap (does NOT free the memory allocated by the heap, use malloc_heap_free_all before destroying the heap).

public static native void
rpmalloc_heap_thread_set_current(long heap)

Sets the given heap as the current heap for the calling thread.

public static boolean
rpmalloc_initialize()

Initializes allocator with default configuration.

public static boolean
rpmalloc_initialize_config(RPMallocConfig
an optional RPMallocConfig instance
config
)

Initializes allocator with given configuration.

public static boolean
rpmalloc_is_thread_initialized()

Query if allocator is initialized for calling thread.

public static native void
rpmalloc_thread_collect()

Performs deferred deallocations pending for the calling thread heap.

public static void
rpmalloc_thread_finalize(boolean
pass non-zero to release thread caches to global cache
release_caches
)

Finalizes allocator for calling thread.

public static native void
rpmalloc_thread_initialize()

Initializes allocator for calling thread.

public static void
rpmalloc_thread_statistics(RPmallocThreadStatistics stats)

Gets per-thread statistics.

public static long
rpmalloc_usable_size(ByteBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

public static long
rpmalloc_usable_size(ShortBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

public static long
rpmalloc_usable_size(IntBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

public static long
rpmalloc_usable_size(LongBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

public static long
rpmalloc_usable_size(FloatBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

public static long
rpmalloc_usable_size(DoubleBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

public static long
rpmalloc_usable_size(PointerBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

public static ByteBuffer
rpmemalign(long alignment, long size)

Allocates a memory block of at least the given size and alignment.

public static int
rpposix_memalign(PointerBuffer memptr, long alignment, long size)

Allocates a memory block of at least the given size and alignment.

public static ByteBuffer
rprealloc(ByteBuffer ptr, long size)

Reallocates the given block to at least the given size.

pack-priv static native long
rprealloc_address()

The realloc function address.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

RPMALLOC_GROW_OR_FAILback to summary
public static final int RPMALLOC_GROW_OR_FAIL

Flag to aligned_realloc to fail and return null pointer if grow cannot be done in-place, in which case the original pointer is still valid (just like a call to realloc which failes to allocate a new block).

RPMALLOC_NO_PRESERVEback to summary
public static final int RPMALLOC_NO_PRESERVE

Flag to aligned_realloc to not preserve content in reallocation.

Constructor Detail

RPmallocback to summary
protected RPmalloc()

Method Detail

nrpaligned_allocback to summary
public static native long nrpaligned_alloc(long alignment, long size)

Unsafe version of: aligned_alloc

nrpaligned_callocback to summary
public static native long nrpaligned_calloc(long alignment, long num, long size)

Unsafe version of: aligned_calloc

nrpaligned_reallocback to summary
public static native long nrpaligned_realloc(long ptr, long alignment, long size, long oldsize, int flags)

Unsafe version of: aligned_realloc

nrpcallocback to summary
public static native long nrpcalloc(long num, long size)

Unsafe version of: calloc

nrpfreeback to summary
public static native void nrpfree(long ptr)

Unsafe version of: free

nrpmallocback to summary
public static native long nrpmalloc(long size)

Unsafe version of: malloc

nrpmalloc_configback to summary
public static native long nrpmalloc_config()

Unsafe version of: malloc_config

nrpmalloc_get_heap_for_ptrback to summary
public static native long nrpmalloc_get_heap_for_ptr(long ptr)

Unsafe version of: malloc_get_heap_for_ptr

nrpmalloc_global_statisticsback to summary
public static native void nrpmalloc_global_statistics(long stats)

Unsafe version of: malloc_global_statistics

nrpmalloc_heap_aligned_allocback to summary
public static native long nrpmalloc_heap_aligned_alloc(long heap, long alignment, long size)

Unsafe version of: malloc_heap_aligned_alloc

nrpmalloc_heap_aligned_callocback to summary
public static native long nrpmalloc_heap_aligned_calloc(long heap, long alignment, long num, long size)

Unsafe version of: malloc_heap_aligned_calloc

nrpmalloc_heap_aligned_reallocback to summary
public static native long nrpmalloc_heap_aligned_realloc(long heap, long ptr, long alignment, long size, int flags)

Unsafe version of: malloc_heap_aligned_realloc

nrpmalloc_heap_allocback to summary
public static native long nrpmalloc_heap_alloc(long heap, long size)

Unsafe version of: malloc_heap_alloc

nrpmalloc_heap_callocback to summary
public static native long nrpmalloc_heap_calloc(long heap, long num, long size)

Unsafe version of: malloc_heap_calloc

nrpmalloc_heap_freeback to summary
public static native void nrpmalloc_heap_free(long heap, long ptr)

Unsafe version of: malloc_heap_free

nrpmalloc_heap_free_allback to summary
public static native void nrpmalloc_heap_free_all(long heap)

Unsafe version of: malloc_heap_free_all

nrpmalloc_heap_reallocback to summary
public static native long nrpmalloc_heap_realloc(long heap, long ptr, long size, int flags)

Unsafe version of: malloc_heap_realloc

nrpmalloc_initializeback to summary
public static native int nrpmalloc_initialize()

Unsafe version of: malloc_initialize

nrpmalloc_initialize_configback to summary
public static native int nrpmalloc_initialize_config(long config)

Unsafe version of: malloc_initialize_config

nrpmalloc_is_thread_initializedback to summary
public static native int nrpmalloc_is_thread_initialized()

Unsafe version of: malloc_is_thread_initialized

nrpmalloc_thread_finalizeback to summary
public static native void nrpmalloc_thread_finalize(int release_caches)

Unsafe version of: malloc_thread_finalize

nrpmalloc_thread_statisticsback to summary
public static native void nrpmalloc_thread_statistics(long stats)

Unsafe version of: malloc_thread_statistics

nrpmalloc_usable_sizeback to summary
public static native long nrpmalloc_usable_size(long ptr)

Unsafe version of: malloc_usable_size

nrpmemalignback to summary
public static native long nrpmemalign(long alignment, long size)

Unsafe version of: memalign

nrpposix_memalignback to summary
public static native int nrpposix_memalign(long memptr, long alignment, long size)

Unsafe version of: posix_memalign

nrpreallocback to summary
public static native long nrprealloc(long ptr, long size)

Unsafe version of: realloc

rpaligned_allocback to summary
public static ByteBuffer rpaligned_alloc(long alignment, long size)

Allocates a memory block of at least the given size and alignment.

Alignment must be a power of two and a multiple of sizeof(void*), and should ideally be less than memory page size. A caveat of rpmalloc internals is that this must also be strictly less than the span size (default 64KiB).

Annotations
@Nullable
@NativeType:void *
rpaligned_alloc_addressback to summary
pack-priv static native long rpaligned_alloc_address()

The aligned_alloc function address.

Annotations
@NativeType:void *
rpaligned_callocback to summary
public static ByteBuffer rpaligned_calloc(long alignment, long num, long size)

Allocates a memory block of at least the given size and alignment, and zero initializes it.

Alignment must be a power of two and a multiple of sizeof(void*), and should ideally be less than memory page size. A caveat of rpmalloc internals is that this must also be strictly less than the span size (default 64KiB).

Annotations
@Nullable
@NativeType:void *
rpaligned_reallocback to summary
public static ByteBuffer rpaligned_realloc(ByteBuffer ptr, long alignment, long size, int flags)

Reallocates the given block to at least the given size and alignment, with optional control flags (see MALLOC_NO_PRESERVE).

Alignment must be a power of two and a multiple of sizeof(void*), and should ideally be less than memory page size. A caveat of rpmalloc internals is that this must also be strictly less than the span size (default 64KiB).

Parameters
flags:int

MALLOC_NO_PRESERVE MALLOC_GROW_OR_FAIL

Annotations
@Nullable
@NativeType:void *
rpcallocback to summary
public static ByteBuffer rpcalloc(long num, long size)

Allocates a memory block of at least the given size and zero initializes it.

Annotations
@Nullable
@NativeType:void *
rpcalloc_addressback to summary
pack-priv static native long rpcalloc_address()

The calloc function address.

Annotations
@NativeType:void *
rpfreeback to summary
public static void rpfree(ByteBuffer ptr)

Frees the given memory block.

rpfreeback to summary
public static void rpfree(ShortBuffer ptr)

Frees the given memory block.

rpfreeback to summary
public static void rpfree(IntBuffer ptr)

Frees the given memory block.

rpfreeback to summary
public static void rpfree(LongBuffer ptr)

Frees the given memory block.

rpfreeback to summary
public static void rpfree(FloatBuffer ptr)

Frees the given memory block.

rpfreeback to summary
public static void rpfree(DoubleBuffer ptr)

Frees the given memory block.

rpfreeback to summary
public static void rpfree(PointerBuffer ptr)

Frees the given memory block.

rpfree_addressback to summary
pack-priv static native long rpfree_address()

The free function address.

Annotations
@NativeType:void *
rpmallocback to summary
public static ByteBuffer rpmalloc(long size)

Allocates a memory block of at least the given size.

Annotations
@Nullable
@NativeType:void *
rpmalloc_addressback to summary
pack-priv static native long rpmalloc_address()

The malloc function address.

Annotations
@NativeType:void *
rpmalloc_configback to summary
public static RPMallocConfig rpmalloc_config()

Gets allocator configuration.

Annotations
@NativeType:rpmalloc_config_t const *
rpmalloc_finalizeback to summary
public static native void rpmalloc_finalize()

Finalizes allocator.

rpmalloc_get_heap_for_ptrback to summary
public static long rpmalloc_get_heap_for_ptr(ByteBuffer ptr)

Returns which heap the given pointer is allocated on.

Annotations
@NativeType:rpmalloc_heap_t *
rpmalloc_get_heap_for_ptrback to summary
public static long rpmalloc_get_heap_for_ptr(ShortBuffer ptr)

Returns which heap the given pointer is allocated on.

Annotations
@NativeType:rpmalloc_heap_t *
rpmalloc_get_heap_for_ptrback to summary
public static long rpmalloc_get_heap_for_ptr(IntBuffer ptr)

Returns which heap the given pointer is allocated on.

Annotations
@NativeType:rpmalloc_heap_t *
rpmalloc_get_heap_for_ptrback to summary
public static long rpmalloc_get_heap_for_ptr(LongBuffer ptr)

Returns which heap the given pointer is allocated on.

Annotations
@NativeType:rpmalloc_heap_t *
rpmalloc_get_heap_for_ptrback to summary
public static long rpmalloc_get_heap_for_ptr(FloatBuffer ptr)

Returns which heap the given pointer is allocated on.

Annotations
@NativeType:rpmalloc_heap_t *
rpmalloc_get_heap_for_ptrback to summary
public static long rpmalloc_get_heap_for_ptr(DoubleBuffer ptr)

Returns which heap the given pointer is allocated on.

Annotations
@NativeType:rpmalloc_heap_t *
rpmalloc_get_heap_for_ptrback to summary
public static long rpmalloc_get_heap_for_ptr(PointerBuffer ptr)

Returns which heap the given pointer is allocated on.

Annotations
@NativeType:rpmalloc_heap_t *
rpmalloc_global_statisticsback to summary
public static void rpmalloc_global_statistics(RPmallocGlobalStatistics stats)

Gets global statistics.

rpmalloc_heap_acquireback to summary
public static native long rpmalloc_heap_acquire()

Acquires a new heap.

Will reuse existing released heaps or allocate memory for a new heap if none available. Heap API is implemented with the strict assumption that only one single thread will call heap functions for a given heap at any given time, no functions are thread safe.

Annotations
@NativeType:rpmalloc_heap_t *
rpmalloc_heap_aligned_allocback to summary
public static ByteBuffer rpmalloc_heap_aligned_alloc(long heap, long alignment, long size)

Allocates a memory block of at least the given size using the given heap.

The returned block will have the requested alignment. Alignment must be a power of two and a multiple of sizeof(void*), and should ideally be less than memory page size. A caveat of rpmalloc internals is that this must also be strictly less than the span size (default 64KiB).

Annotations
@Nullable
@NativeType:void *
rpmalloc_heap_aligned_callocback to summary
public static ByteBuffer rpmalloc_heap_aligned_calloc(long heap, long alignment, long num, long size)

Allocates a memory block of at least the given size using the given heap and zero initializes it.

The returned block will have the requested alignment. Alignment must either be zero, or a power of two and a multiple of sizeof(void*), and should ideally be less than memory page size. A caveat of rpmalloc internals is that this must also be strictly less than the span size (default 64KiB).

Parameters
num:long

'

Annotations
@Nullable
@NativeType:void *
rpmalloc_heap_aligned_reallocback to summary
public static ByteBuffer rpmalloc_heap_aligned_realloc(long heap, ByteBuffer ptr, long alignment, long size, int flags)

Reallocates the given block to at least the given size.

The memory block MUST be allocated by the same heap given to this function. The returned block will have the requested alignment. Alignment must be either zero, or a power of two and a multiple of sizeof(void*), and should ideally be less than memory page size. A caveat of rpmalloc internals is that this must also be strictly less than the span size (default 64KiB).

Parameters
flags:int

MALLOC_NO_PRESERVE MALLOC_GROW_OR_FAIL

Annotations
@Nullable
@NativeType:void *
rpmalloc_heap_allocback to summary
public static ByteBuffer rpmalloc_heap_alloc(long heap, long size)

Allocates a memory block of at least the given size using the given heap.

Annotations
@Nullable
@NativeType:void *
rpmalloc_heap_callocback to summary
public static ByteBuffer rpmalloc_heap_calloc(long heap, long num, long size)

Allocates a memory block of at least the given size using the given heap and zero initializes it.

Annotations
@Nullable
@NativeType:void *
rpmalloc_heap_freeback to summary
public static void rpmalloc_heap_free(long heap, ByteBuffer ptr)

Frees the given memory block from the given heap.

The memory block MUST be allocated by the same heap given to this function.

rpmalloc_heap_freeback to summary
public static void rpmalloc_heap_free(long heap, ShortBuffer ptr)

Frees the given memory block from the given heap.

The memory block MUST be allocated by the same heap given to this function.

rpmalloc_heap_freeback to summary
public static void rpmalloc_heap_free(long heap, IntBuffer ptr)

Frees the given memory block from the given heap.

The memory block MUST be allocated by the same heap given to this function.

rpmalloc_heap_freeback to summary
public static void rpmalloc_heap_free(long heap, LongBuffer ptr)

Frees the given memory block from the given heap.

The memory block MUST be allocated by the same heap given to this function.

rpmalloc_heap_freeback to summary
public static void rpmalloc_heap_free(long heap, FloatBuffer ptr)

Frees the given memory block from the given heap.

The memory block MUST be allocated by the same heap given to this function.

rpmalloc_heap_freeback to summary
public static void rpmalloc_heap_free(long heap, DoubleBuffer ptr)

Frees the given memory block from the given heap.

The memory block MUST be allocated by the same heap given to this function.

rpmalloc_heap_freeback to summary
public static void rpmalloc_heap_free(long heap, PointerBuffer ptr)

Frees the given memory block from the given heap.

The memory block MUST be allocated by the same heap given to this function.

rpmalloc_heap_free_allback to summary
public static void rpmalloc_heap_free_all(long heap)

Frees all memory allocated by the heap.

rpmalloc_heap_reallocback to summary
public static ByteBuffer rpmalloc_heap_realloc(long heap, ByteBuffer ptr, long size, int flags)

Reallocates the given block to at least the given size.

The memory block MUST be allocated by the same heap given to this function.

Parameters
flags:int

MALLOC_NO_PRESERVE MALLOC_GROW_OR_FAIL

Annotations
@Nullable
@NativeType:void *
rpmalloc_heap_releaseback to summary
public static native void rpmalloc_heap_release(long heap)

Releases a heap (does NOT free the memory allocated by the heap, use malloc_heap_free_all before destroying the heap).

Releasing a heap will enable it to be reused by other threads. Safe to pass a null pointer.

rpmalloc_heap_thread_set_currentback to summary
public static native void rpmalloc_heap_thread_set_current(long heap)

Sets the given heap as the current heap for the calling thread.

A heap MUST only be current heap for a single thread, a heap can never be shared between multiple threads. The previous current heap for the calling thread is released to be reused by other threads.

rpmalloc_initializeback to summary
public static boolean rpmalloc_initialize()

Initializes allocator with default configuration.

Annotations
@NativeType:int
rpmalloc_initialize_configback to summary
public static boolean rpmalloc_initialize_config(RPMallocConfig config)

Initializes allocator with given configuration.

Parameters
config:RPMallocConfig

an optional RPMallocConfig instance

Annotations
@NativeType:int
rpmalloc_is_thread_initializedback to summary
public static boolean rpmalloc_is_thread_initialized()

Query if allocator is initialized for calling thread.

Annotations
@NativeType:int
rpmalloc_thread_collectback to summary
public static native void rpmalloc_thread_collect()

Performs deferred deallocations pending for the calling thread heap.

rpmalloc_thread_finalizeback to summary
public static void rpmalloc_thread_finalize(boolean release_caches)

Finalizes allocator for calling thread.

Parameters
release_caches:boolean

pass non-zero to release thread caches to global cache

rpmalloc_thread_initializeback to summary
public static native void rpmalloc_thread_initialize()

Initializes allocator for calling thread.

rpmalloc_thread_statisticsback to summary
public static void rpmalloc_thread_statistics(RPmallocThreadStatistics stats)

Gets per-thread statistics.

rpmalloc_usable_sizeback to summary
public static long rpmalloc_usable_size(ByteBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

Annotations
@NativeType:size_t
rpmalloc_usable_sizeback to summary
public static long rpmalloc_usable_size(ShortBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

Annotations
@NativeType:size_t
rpmalloc_usable_sizeback to summary
public static long rpmalloc_usable_size(IntBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

Annotations
@NativeType:size_t
rpmalloc_usable_sizeback to summary
public static long rpmalloc_usable_size(LongBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

Annotations
@NativeType:size_t
rpmalloc_usable_sizeback to summary
public static long rpmalloc_usable_size(FloatBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

Annotations
@NativeType:size_t
rpmalloc_usable_sizeback to summary
public static long rpmalloc_usable_size(DoubleBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

Annotations
@NativeType:size_t
rpmalloc_usable_sizeback to summary
public static long rpmalloc_usable_size(PointerBuffer ptr)

Queries the usable size of the given memory block (from given pointer to the end of block).

Annotations
@NativeType:size_t
rpmemalignback to summary
public static ByteBuffer rpmemalign(long alignment, long size)

Allocates a memory block of at least the given size and alignment.

Alignment must be a power of two and a multiple of sizeof(void*), and should ideally be less than memory page size. A caveat of rpmalloc internals is that this must also be strictly less than the span size (default 64KiB).

Annotations
@Nullable
@NativeType:void *
rpposix_memalignback to summary
public static int rpposix_memalign(PointerBuffer memptr, long alignment, long size)

Allocates a memory block of at least the given size and alignment.

Alignment must be a power of two and a multiple of sizeof(void*), and should ideally be less than memory page size. A caveat of rpmalloc internals is that this must also be strictly less than the span size (default 64KiB).

rpreallocback to summary
public static ByteBuffer rprealloc(ByteBuffer ptr, long size)

Reallocates the given block to at least the given size.

Annotations
@Nullable
@NativeType:void *
rprealloc_addressback to summary
pack-priv static native long rprealloc_address()

The realloc function address.

Annotations
@NativeType:void *