Package org.lwjgl.system.jemalloc
Class ChunkHooks
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.system.jemalloc.ChunkHooks
-
- All Implemented Interfaces:
- java.lang.AutoCloseable, NativeResource, Pointer
public class ChunkHooks extends Struct
Comprises function pointers which are described individually below. jemalloc uses these functions to manage chunk lifetime, which starts off with allocation of mapped committed memory, in the simplest case followed by deallocation. However, there are performance and platform reasons to retain chunks for later reuse. Cleanup attempts cascade from deallocation to decommit to purging, which gives the chunk management functions opportunities to reject the most permanent cleanup operations in favor of less permanent (and often less costly) operations. The chunk splitting and merging operations can also be opted out of, but this is mainly intended to support platforms on which virtual memory mappings provided by the operating system kernel do not automatically coalesce and split, e.g. Windows.Member documentation
alloc– the chunk allocation hookdalloc– the chunk deallocation hookcommit– the chunk commit hookdecommit– the chunk decommit hookpurge– the chunk purge hooksplit– the chunk split hookmerge– the chunk merge hook
Layout
struct chunk_hooks_t { chunk_alloc_t alloc; chunk_dalloc_t dalloc; chunk_commit_t commit; chunk_decommit_t decommit; chunk_purge_t purge; chunk_split_t split; chunk_merge_t merge; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classChunkHooks.BufferAn array ofChunkHooksstructs.-
Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer
Pointer.Default
-
-
Field Summary
Fields Modifier and Type Field and Description static intSIZEOFThe struct size in bytes.-
Fields inherited from interface org.lwjgl.system.Pointer
POINTER_SHIFT, POINTER_SIZE
-
-
Constructor Summary
Constructors Constructor and Description ChunkHooks(java.nio.ByteBuffer container)Creates aChunkHooksinstance at the current position of the specifiedByteBuffercontainer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description ChunkAllocalloc()Returns theChunkAllocinstance at theallocfield.ChunkHooksalloc(ChunkAllocI value)Sets the address of the specifiedChunkAllocIto theallocfield.static ChunkHookscalloc()Returns a newChunkHooksinstance allocated withmemCalloc.static ChunkHooks.Buffercalloc(int capacity)Returns a newChunkHooks.Bufferinstance allocated withmemCalloc.static ChunkHookscallocStack()Returns a newChunkHooksinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.static ChunkHooks.BuffercallocStack(int capacity)Returns a newChunkHooks.Bufferinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.static ChunkHooks.BuffercallocStack(int capacity, MemoryStack stack)Returns a newChunkHooks.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static ChunkHookscallocStack(MemoryStack stack)Returns a newChunkHooksinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.ChunkCommitcommit()Returns theChunkCommitinstance at thecommitfield.ChunkHookscommit(ChunkCommitI value)Sets the address of the specifiedChunkCommitIto thecommitfield.static ChunkHookscreate()Returns a newChunkHooksinstance allocated withBufferUtils.static ChunkHooks.Buffercreate(int capacity)Returns a newChunkHooks.Bufferinstance allocated withBufferUtils.static ChunkHookscreate(long address)static ChunkHooks.Buffercreate(long address, int capacity)Create aChunkHooks.Bufferinstance at the specified memory.ChunkDallocdalloc()Returns theChunkDallocinstance at thedallocfield.ChunkHooksdalloc(ChunkDallocI value)Sets the address of the specifiedChunkDallocIto thedallocfield.ChunkDecommitdecommit()Returns theChunkDecommitinstance at thedecommitfield.ChunkHooksdecommit(ChunkDecommitI value)Sets the address of the specifiedChunkDecommitIto thedecommitfield.static ChunkHooksmalloc()Returns a newChunkHooksinstance allocated withmemAlloc.static ChunkHooks.Buffermalloc(int capacity)Returns a newChunkHooks.Bufferinstance allocated withmemAlloc.static ChunkHooksmallocStack()Returns a newChunkHooksinstance allocated on the thread-localMemoryStack.static ChunkHooks.BuffermallocStack(int capacity)Returns a newChunkHooks.Bufferinstance allocated on the thread-localMemoryStack.static ChunkHooks.BuffermallocStack(int capacity, MemoryStack stack)Returns a newChunkHooks.Bufferinstance allocated on the specifiedMemoryStack.static ChunkHooksmallocStack(MemoryStack stack)Returns a newChunkHooksinstance allocated on the specifiedMemoryStack.ChunkMergemerge()Returns theChunkMergeinstance at themergefield.ChunkHooksmerge(ChunkMergeI value)Sets the address of the specifiedChunkMergeIto themergefield.ChunkHooksnset(long struct)Unsafe version ofset.ChunkPurgepurge()Returns theChunkPurgeinstance at thepurgefield.ChunkHookspurge(ChunkPurgeI value)Sets the address of the specifiedChunkPurgeIto thepurgefield.ChunkHooksset(ChunkAllocI alloc, ChunkDallocI dalloc, ChunkCommitI commit, ChunkDecommitI decommit, ChunkPurgeI purge, ChunkSplitI split, ChunkMergeI merge)Initializes this struct with the specified values.ChunkHooksset(ChunkHooks src)Copies the specified struct data to this struct.intsizeof()Returns thesizeof(struct).ChunkSplitsplit()Returns theChunkSplitinstance at thesplitfield.ChunkHookssplit(ChunkSplitI value)Sets the address of the specifiedChunkSplitIto thesplitfield.static voidvalidate(long struct)Validates pointer members that should not beNULL.static voidvalidate(long array, int count)CallsChunkHooks.validate(long)for each struct contained in the specified struct array.-
Methods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toString
-
Methods inherited from interface org.lwjgl.system.NativeResource
close
-
-
-
-
Constructor Detail
-
ChunkHooks
public ChunkHooks(java.nio.ByteBuffer container)
Creates aChunkHooksinstance at the current position of the specifiedByteBuffercontainer. Changes to the buffer's content will be visible to the struct instance and vice versa.The created instance holds a strong reference to the container object.
-
-
Method Detail
-
sizeof
public int sizeof()
Description copied from class:StructReturns thesizeof(struct).
-
alloc
public ChunkAlloc alloc()
Returns theChunkAllocinstance at theallocfield.
-
dalloc
public ChunkDalloc dalloc()
Returns theChunkDallocinstance at thedallocfield.
-
commit
public ChunkCommit commit()
Returns theChunkCommitinstance at thecommitfield.
-
decommit
public ChunkDecommit decommit()
Returns theChunkDecommitinstance at thedecommitfield.
-
purge
public ChunkPurge purge()
Returns theChunkPurgeinstance at thepurgefield.
-
split
public ChunkSplit split()
Returns theChunkSplitinstance at thesplitfield.
-
merge
public ChunkMerge merge()
Returns theChunkMergeinstance at themergefield.
-
alloc
public ChunkHooks alloc(ChunkAllocI value)
Sets the address of the specifiedChunkAllocIto theallocfield.
-
dalloc
public ChunkHooks dalloc(ChunkDallocI value)
Sets the address of the specifiedChunkDallocIto thedallocfield.
-
commit
public ChunkHooks commit(ChunkCommitI value)
Sets the address of the specifiedChunkCommitIto thecommitfield.
-
decommit
public ChunkHooks decommit(ChunkDecommitI value)
Sets the address of the specifiedChunkDecommitIto thedecommitfield.
-
purge
public ChunkHooks purge(ChunkPurgeI value)
Sets the address of the specifiedChunkPurgeIto thepurgefield.
-
split
public ChunkHooks split(ChunkSplitI value)
Sets the address of the specifiedChunkSplitIto thesplitfield.
-
merge
public ChunkHooks merge(ChunkMergeI value)
Sets the address of the specifiedChunkMergeIto themergefield.
-
set
public ChunkHooks set(ChunkAllocI alloc, ChunkDallocI dalloc, ChunkCommitI commit, ChunkDecommitI decommit, ChunkPurgeI purge, ChunkSplitI split, ChunkMergeI merge)
Initializes this struct with the specified values.
-
nset
public ChunkHooks nset(long struct)
Unsafe version ofset.
-
set
public ChunkHooks set(ChunkHooks src)
Copies the specified struct data to this struct.- Parameters:
src- the source struct- Returns:
- this struct
-
malloc
public static ChunkHooks malloc()
Returns a newChunkHooksinstance allocated withmemAlloc. The instance must be explicitly freed.
-
calloc
public static ChunkHooks calloc()
Returns a newChunkHooksinstance allocated withmemCalloc. The instance must be explicitly freed.
-
create
public static ChunkHooks create()
Returns a newChunkHooksinstance allocated withBufferUtils.
-
create
public static ChunkHooks create(long address)
-
malloc
public static ChunkHooks.Buffer malloc(int capacity)
Returns a newChunkHooks.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
public static ChunkHooks.Buffer calloc(int capacity)
Returns a newChunkHooks.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
public static ChunkHooks.Buffer create(int capacity)
Returns a newChunkHooks.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
public static ChunkHooks.Buffer create(long address, int capacity)
Create aChunkHooks.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
mallocStack
public static ChunkHooks mallocStack()
Returns a newChunkHooksinstance allocated on the thread-localMemoryStack.
-
callocStack
public static ChunkHooks callocStack()
Returns a newChunkHooksinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.
-
mallocStack
public static ChunkHooks mallocStack(MemoryStack stack)
Returns a newChunkHooksinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
callocStack
public static ChunkHooks callocStack(MemoryStack stack)
Returns a newChunkHooksinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
mallocStack
public static ChunkHooks.Buffer mallocStack(int capacity)
Returns a newChunkHooks.Bufferinstance allocated on the thread-localMemoryStack.- Parameters:
capacity- the buffer capacity
-
callocStack
public static ChunkHooks.Buffer callocStack(int capacity)
Returns a newChunkHooks.Bufferinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacity
-
mallocStack
public static ChunkHooks.Buffer mallocStack(int capacity, MemoryStack stack)
Returns a newChunkHooks.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
callocStack
public static ChunkHooks.Buffer callocStack(int capacity, MemoryStack stack)
Returns a newChunkHooks.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
validate
public static void validate(long struct)
Validates pointer members that should not beNULL.- Parameters:
struct- the struct to validate
-
validate
public static void validate(long array, int count)CallsChunkHooks.validate(long)for each struct contained in the specified struct array.- Parameters:
array- the struct array to validatecount- the number of structs inarray
-
-