public interface CommittedMemoryProvider
Modifier and Type | Interface and Description |
---|---|
static class |
CommittedMemoryProvider.Access |
Modifier and Type | Field and Description |
---|---|
static org.graalvm.word.UnsignedWord |
UNALIGNED
Value for alignment parameters that indicates that no specific alignment is required (other
than the granularity usually).
|
Modifier and Type | Method and Description |
---|---|
default void |
afterGarbageCollection(boolean completeCollection)
Called by the garbage collector after a collection has ended, as an opportunity to perform
lazy operations, sanity checks or clean-ups.
|
org.graalvm.word.Pointer |
allocate(org.graalvm.word.UnsignedWord nbytes,
org.graalvm.word.UnsignedWord alignment,
boolean executable)
Allocate a block of committed memory.
|
default void |
beforeGarbageCollection()
Called by the garbage collector before a collection is started, as an opportunity to perform
lazy operations, sanity checks or clean-ups.
|
boolean |
free(org.graalvm.word.PointerBase start,
org.graalvm.word.UnsignedWord nbytes,
org.graalvm.word.UnsignedWord alignment,
boolean executable)
Release a block of committed memory that was allocated with
CommittedMemoryProvider.allocate(org.graalvm.word.UnsignedWord, org.graalvm.word.UnsignedWord, boolean) , requiring the
exact same parameter values that were originally passed to CommittedMemoryProvider.allocate(org.graalvm.word.UnsignedWord, org.graalvm.word.UnsignedWord, boolean) . |
static CommittedMemoryProvider |
get() |
default org.graalvm.word.UnsignedWord |
getGranularity()
Returns the granularity of committed memory management, which is typically the same as that
of virtual memory management.
|
boolean |
guaranteesHeapPreferredAddressSpaceAlignment()
Returns whether this provider will always guarantee a heap address space alignment of
Heap.getPreferredAddressSpaceAlignment() at image runtime, which may also depend on
ImageHeapProvider.guaranteesHeapPreferredAddressSpaceAlignment() . |
int |
initialize(org.graalvm.nativeimage.c.type.WordPointer isolatePointer,
CEntryPointCreateIsolateParameters parameters)
Performs initializations for the current isolate, before any other methods of this
interface may be called.
|
boolean |
protect(org.graalvm.word.PointerBase start,
org.graalvm.word.UnsignedWord nbytes,
EnumSet<CommittedMemoryProvider.Access> access)
Change access permissions for a block of committed memory that was allocated with
CommittedMemoryProvider.allocate(org.graalvm.word.UnsignedWord, org.graalvm.word.UnsignedWord, boolean) . |
int |
tearDown()
Tear down for the current isolate.
|
static final org.graalvm.word.UnsignedWord UNALIGNED
static CommittedMemoryProvider get()
boolean guaranteesHeapPreferredAddressSpaceAlignment()
Heap.getPreferredAddressSpaceAlignment()
at image runtime, which may also depend on
ImageHeapProvider.guaranteesHeapPreferredAddressSpaceAlignment()
.int initialize(org.graalvm.nativeimage.c.type.WordPointer isolatePointer, CEntryPointCreateIsolateParameters parameters)
int tearDown()
default org.graalvm.word.UnsignedWord getGranularity()
org.graalvm.word.Pointer allocate(org.graalvm.word.UnsignedWord nbytes, org.graalvm.word.UnsignedWord alignment, boolean executable)
nbytes
- The number of bytes to allocate, which is rounded up to the next multiple of
the granularity if required.alignment
- The required alignment of the block start, or CommittedMemoryProvider.UNALIGNED
.executable
- Whether the block must be executable.WordFactory.nullPointer()
in case of an
error.boolean free(org.graalvm.word.PointerBase start, org.graalvm.word.UnsignedWord nbytes, org.graalvm.word.UnsignedWord alignment, boolean executable)
CommittedMemoryProvider.allocate(org.graalvm.word.UnsignedWord, org.graalvm.word.UnsignedWord, boolean)
, requiring the
exact same parameter values that were originally passed to CommittedMemoryProvider.allocate(org.graalvm.word.UnsignedWord, org.graalvm.word.UnsignedWord, boolean)
.start
- The start of the memory block, as returned by CommittedMemoryProvider.allocate(org.graalvm.word.UnsignedWord, org.graalvm.word.UnsignedWord, boolean)
.nbytes
- The originally requested size in bytes.alignment
- The originally requested alignment.executable
- Whether the block was requested to be executable.default void beforeGarbageCollection()
default void afterGarbageCollection(boolean completeCollection)
completeCollection
- Whether the garbage collector has performed a full collection.boolean protect(org.graalvm.word.PointerBase start, org.graalvm.word.UnsignedWord nbytes, EnumSet<CommittedMemoryProvider.Access> access)
CommittedMemoryProvider.allocate(org.graalvm.word.UnsignedWord, org.graalvm.word.UnsignedWord, boolean)
.start
- The start of the address range to be protected, which must be a multiple of the
granularity.nbytes
- The size in bytes of the address range to be protected, which will be rounded
up to a multiple of the granularity.access
- The modes in which the memory is permitted to be accessed, see CommittedMemoryProvider.Access
.