VirtualAlloc/mmap if none
provided. This allows rpmalloc to be used in contexts where memory is provided by internal means.
Page size may be set explicitly in initialization. This allows the allocator to be used as a sub-allocator where the page granularity should be lower to reduce risk of wasting unused memory ranges.
If rpmalloc is built with ENABLE_GUARDS, memory_overwrite may be set to detect writes before or after allocated memory blocks. This is
not enabled in the default LWJGL build.
struct rpmalloc_config_t {
void * (*memory_map) (size_t size, size_t *offset);
void (*memory_unmap) (void *address, size_t size, size_t offset, int release);
void (*error_callback) (char const *message);
int (*map_fail_callback) (size_t size);
size_t page_size;
size_t span_size;
size_t span_map_count;
int enable_huge_pages;
char const * page_name;
char const * huge_page_name;
}
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ALIGNOF
The struct alignment in bytes. |
| public static final int | ENABLE_HUGE_PAGES
The struct member offsets. |
| public static final int | ERROR_CALLBACK
The struct member offsets. |
| public static final int | HUGE_PAGE_NAME
The struct member offsets. |
| public static final int | MAP_FAIL_CALLBACK
The struct member offsets. |
| public static final int | MEMORY_MAP
The struct member offsets. |
| public static final int | MEMORY_UNMAP
The struct member offsets. |
| public static final int | PAGE_NAME
The struct member offsets. |
| public static final int | PAGE_SIZE
The struct member offsets. |
| public static final int | SIZEOF
The struct size in bytes. |
| public static final int | SPAN_MAP_COUNT
The struct member offsets. |
| public static final int | SPAN_SIZE
The struct member offsets. |
| Access | Constructor and Description |
|---|---|
| protected | |
| public | RPMallocConfig(ByteBuffer container)
Creates a |
| Modifier and Type | Method and Description |
|---|---|
| public static RPMallocConfig | |
| public static RPMallocConfig | calloc(MemoryStack
the stack from which to allocate stack)Returns a new |
| public static RPMallocConfig | |
| public static RPMallocConfig | |
| protected RPMallocConfig | create(long
the struct memory address address, ByteBuffer an optional container buffer, to be referenced strongly by the struct instance. container)Implements abstract org. the constructor, but returns the exact type of the Struct subclass.
|
| public static RPMallocConfig | |
| public static RPMallocConfig | |
| public static RPMallocConfig | |
| public boolean | |
| public RPMallocConfig | |
| public RPErrorCallback | |
| public RPMallocConfig | |
| public ByteBuffer | huge_page_name()
huge allocated pages name for systems supporting it to be able to distinguish among anonymous regions |
| public RPMallocConfig | huge_page_name(ByteBuffer value)
Sets the address of the specified encoded string to the |
| public String | huge_page_nameString()
huge allocated pages name for systems supporting it to be able to distinguish among anonymous regions |
| public static RPMallocConfig | |
| public static RPMallocConfig | malloc(MemoryStack
the stack from which to allocate stack)Returns a new |
| public static RPMallocConfig | |
| public static RPMallocConfig | |
| public RPMapFailCallback | |
| public RPMallocConfig | |
| public RPMemoryMapCallback | |
| public RPMallocConfig | |
| public RPMemoryUnmapCallback | |
| public RPMallocConfig | |
| public static int | |
| public static void | |
| public static RPErrorCallback | |
| public static void | |
| public static ByteBuffer | |
| public static void | |
| public static String | |
| public static RPMapFailCallback | |
| public static void | |
| public static RPMemoryMapCallback | |
| public static void | |
| public static RPMemoryUnmapCallback | |
| public static void | |
| public static ByteBuffer | |
| public static void | |
| public static String | |
| public static long | |
| public static void | |
| public static long | |
| public static void | |
| public static long | |
| public static void | |
| public ByteBuffer | page_name()
allocated pages name for systems supporting it to be able to distinguish among anonymous regions |
| public RPMallocConfig | |
| public String | page_nameString()
allocated pages name for systems supporting it to be able to distinguish among anonymous regions |
| public long | |
| public RPMallocConfig | |
| public RPMallocConfig | set(RPMemoryMapCallbackI memory_map, RPMemoryUnmapCallbackI memory_unmap, RPErrorCallbackI error_callback, RPMapFailCallbackI map_fail_callback, long page_size, long span_size, long span_map_count, boolean enable_huge_pages, ByteBuffer page_name, ByteBuffer huge_page_name)
Initializes this struct with the specified values. |
| public RPMallocConfig | Returns: this structthe source struct src)Copies the specified struct data to this struct. |
| public int | |
| public long | |
| public RPMallocConfig | |
| public long | |
| public RPMallocConfig |
| ALIGNOF | back to summary |
|---|---|
| public static final int ALIGNOF The struct alignment in bytes. | |
| ENABLE_HUGE_PAGES | back to summary |
|---|---|
| public static final int ENABLE_HUGE_PAGES The struct member offsets. | |
| ERROR_CALLBACK | back to summary |
|---|---|
| public static final int ERROR_CALLBACK The struct member offsets. | |
| HUGE_PAGE_NAME | back to summary |
|---|---|
| public static final int HUGE_PAGE_NAME The struct member offsets. | |
| MAP_FAIL_CALLBACK | back to summary |
|---|---|
| public static final int MAP_FAIL_CALLBACK The struct member offsets. | |
| MEMORY_MAP | back to summary |
|---|---|
| public static final int MEMORY_MAP The struct member offsets. | |
| MEMORY_UNMAP | back to summary |
|---|---|
| public static final int MEMORY_UNMAP The struct member offsets. | |
| PAGE_NAME | back to summary |
|---|---|
| public static final int PAGE_NAME The struct member offsets. | |
| PAGE_SIZE | back to summary |
|---|---|
| public static final int PAGE_SIZE The struct member offsets. | |
| SIZEOF | back to summary |
|---|---|
| public static final int SIZEOF The struct size in bytes. | |
| SPAN_MAP_COUNT | back to summary |
|---|---|
| public static final int SPAN_MAP_COUNT The struct member offsets. | |
| SPAN_SIZE | back to summary |
|---|---|
| public static final int SPAN_SIZE The struct member offsets. | |
| RPMallocConfig | back to summary |
|---|---|
| protected RPMallocConfig(long address, ByteBuffer container) | |
| RPMallocConfig | back to summary |
|---|---|
| public RPMallocConfig(ByteBuffer container) Creates a The created instance holds a strong reference to the container object. | |
| calloc | back to summary |
|---|---|
| public static RPMallocConfig calloc() Returns a new | |
| calloc | back to summary |
|---|---|
| public static RPMallocConfig calloc(MemoryStack stack) Returns a new
| |
| callocStack | back to summary |
|---|---|
| public static RPMallocConfig callocStack()
Deprecated
Deprecated for removal in 3.4.0. Use
| |
| callocStack | back to summary |
|---|---|
| public static RPMallocConfig callocStack(MemoryStack stack)
Deprecated
Deprecated for removal in 3.4.0. Use
| |
| create | back to summary |
|---|---|
| protected RPMallocConfig create(long address, ByteBuffer container) Implements abstract org. Doc from org. Similar to Effectively, every
| |
| create | back to summary |
|---|---|
| public static RPMallocConfig create() Returns a new | |
| create | back to summary |
|---|---|
| public static RPMallocConfig create(long address) Returns a new | |
| createSafe | back to summary |
|---|---|
| public static RPMallocConfig createSafe(long address) Like
| |
| enable_huge_pages | back to summary |
|---|---|
| public boolean enable_huge_pages() enable use of large/huge pages. If this flag is set to non-zero and page size is zero, the allocator will try to enable huge pages and auto detect the configuration. If this is set to non-zero and page_size is also non-zero, the allocator will assume huge pages have been configured and enabled prior to initializing the allocator. For Windows, see large-page-support. For Linux, see hugetlbpage.txt.
| |
| enable_huge_pages | back to summary |
|---|---|
| public RPMallocConfig enable_huge_pages(boolean value) Sets the specified value to the | |
| error_callback | back to summary |
|---|---|
| public RPErrorCallback error_callback() the error callback function
| |
| error_callback | back to summary |
|---|---|
| public RPMallocConfig error_callback(RPErrorCallbackI value) Sets the specified value to the | |
| huge_page_name | back to summary |
|---|---|
| public ByteBuffer huge_page_name() huge allocated pages name for systems supporting it to be able to distinguish among anonymous regions
| |
| huge_page_name | back to summary |
|---|---|
| public RPMallocConfig huge_page_name(ByteBuffer value) Sets the address of the specified encoded string to the | |
| huge_page_nameString | back to summary |
|---|---|
| public String huge_page_nameString() huge allocated pages name for systems supporting it to be able to distinguish among anonymous regions
| |
| malloc | back to summary |
|---|---|
| public static RPMallocConfig malloc() Returns a new | |
| malloc | back to summary |
|---|---|
| public static RPMallocConfig malloc(MemoryStack stack) Returns a new
| |
| mallocStack | back to summary |
|---|---|
| public static RPMallocConfig mallocStack()
Deprecated
Deprecated for removal in 3.4.0. Use
| |
| mallocStack | back to summary |
|---|---|
| public static RPMallocConfig mallocStack(MemoryStack stack)
Deprecated
Deprecated for removal in 3.4.0. Use
| |
| map_fail_callback | back to summary |
|---|---|
| public RPMapFailCallback map_fail_callback() the map fail callback function
| |
| map_fail_callback | back to summary |
|---|---|
| public RPMallocConfig map_fail_callback(RPMapFailCallbackI value) Sets the specified value to the | |
| memory_map | back to summary |
|---|---|
| public RPMemoryMapCallback memory_map() the memory map callback function
| |
| memory_map | back to summary |
|---|---|
| public RPMallocConfig memory_map(RPMemoryMapCallbackI value) Sets the specified value to the | |
| memory_unmap | back to summary |
|---|---|
| public RPMemoryUnmapCallback memory_unmap() the memory unmap callback function
| |
| memory_unmap | back to summary |
|---|---|
| public RPMallocConfig memory_unmap(RPMemoryUnmapCallbackI value) Sets the specified value to the | |
| nenable_huge_pages | back to summary |
|---|---|
| public static int nenable_huge_pages(long struct) Unsafe version of | |
| nenable_huge_pages | back to summary |
|---|---|
| public static void nenable_huge_pages(long struct, int value) Unsafe version of | |
| nerror_callback | back to summary |
|---|---|
| public static RPErrorCallback nerror_callback(long struct) Unsafe version of
| |
| nerror_callback | back to summary |
|---|---|
| public static void nerror_callback(long struct, RPErrorCallbackI value) Unsafe version of | |
| nhuge_page_name | back to summary |
|---|---|
| public static ByteBuffer nhuge_page_name(long struct) Unsafe version of
| |
| nhuge_page_name | back to summary |
|---|---|
| public static void nhuge_page_name(long struct, ByteBuffer value) Unsafe version of | |
| nhuge_page_nameString | back to summary |
|---|---|
| public static String nhuge_page_nameString(long struct) Unsafe version of
| |
| nmap_fail_callback | back to summary |
|---|---|
| public static RPMapFailCallback nmap_fail_callback(long struct) Unsafe version of
| |
| nmap_fail_callback | back to summary |
|---|---|
| public static void nmap_fail_callback(long struct, RPMapFailCallbackI value) Unsafe version of | |
| nmemory_map | back to summary |
|---|---|
| public static RPMemoryMapCallback nmemory_map(long struct) Unsafe version of
| |
| nmemory_map | back to summary |
|---|---|
| public static void nmemory_map(long struct, RPMemoryMapCallbackI value) Unsafe version of | |
| nmemory_unmap | back to summary |
|---|---|
| public static RPMemoryUnmapCallback nmemory_unmap(long struct) Unsafe version of
| |
| nmemory_unmap | back to summary |
|---|---|
| public static void nmemory_unmap(long struct, RPMemoryUnmapCallbackI value) Unsafe version of | |
| npage_name | back to summary |
|---|---|
| public static ByteBuffer npage_name(long struct) Unsafe version of
| |
| npage_name | back to summary |
|---|---|
| public static void npage_name(long struct, ByteBuffer value) Unsafe version of | |
| npage_nameString | back to summary |
|---|---|
| public static String npage_nameString(long struct) Unsafe version of
| |
| npage_size | back to summary |
|---|---|
| public static long npage_size(long struct) Unsafe version of | |
| npage_size | back to summary |
|---|---|
| public static void npage_size(long struct, long value) Unsafe version of | |
| nspan_map_count | back to summary |
|---|---|
| public static long nspan_map_count(long struct) Unsafe version of | |
| nspan_map_count | back to summary |
|---|---|
| public static void nspan_map_count(long struct, long value) Unsafe version of | |
| nspan_size | back to summary |
|---|---|
| public static long nspan_size(long struct) Unsafe version of | |
| nspan_size | back to summary |
|---|---|
| public static void nspan_size(long struct, long value) Unsafe version of | |
| page_name | back to summary |
|---|---|
| public ByteBuffer page_name() allocated pages name for systems supporting it to be able to distinguish among anonymous regions
| |
| page_name | back to summary |
|---|---|
| public RPMallocConfig page_name(ByteBuffer value) Sets the address of the specified encoded string to the | |
| page_nameString | back to summary |
|---|---|
| public String page_nameString() allocated pages name for systems supporting it to be able to distinguish among anonymous regions
| |
| page_size | back to summary |
|---|---|
| public long page_size() the size of memory pages. The page size MUST be a power of two in Used if
| |
| page_size | back to summary |
|---|---|
| public RPMallocConfig page_size(long value) Sets the specified value to the | |
| set | back to summary |
|---|---|
| public RPMallocConfig set(RPMemoryMapCallbackI memory_map, RPMemoryUnmapCallbackI memory_unmap, RPErrorCallbackI error_callback, RPMapFailCallbackI map_fail_callback, long page_size, long span_size, long span_map_count, boolean enable_huge_pages, ByteBuffer page_name, ByteBuffer huge_page_name) Initializes this struct with the specified values. | |
| set | back to summary |
|---|---|
| public RPMallocConfig set(RPMallocConfig src) Copies the specified struct data to this struct.
| |
| sizeof | back to summary |
|---|---|
| public int sizeof() Implements abstract org. Doc from org. Returns
| |
| span_map_count | back to summary |
|---|---|
| public long span_map_count() number of spans to map at each request to map new virtual memory blocks. This can be used to minimize the system call overhead at the cost of virtual memory address space. The extra mapped pages will not be written until actually used, so physical committed memory should not be affected in the default implementation. Will be aligned to a multiple of spans that match memory page size in case of huge pages.
| |
| span_map_count | back to summary |
|---|---|
| public RPMallocConfig span_map_count(long value) Sets the specified value to the | |
| span_size | back to summary |
|---|---|
| public long span_size() size of a span of memory blocks. MUST be a power of two, and in Used if
| |
| span_size | back to summary |
|---|---|
| public RPMallocConfig span_size(long value) Sets the specified value to the | |