Uses of Interface
jdk.incubator.foreign.ResourceScope
Package
Description
Classes to support low-level and efficient foreign memory/function access, directly from Java.
-
Uses of ResourceScope in jdk.incubator.foreign
Modifier and TypeMethodDescriptionstatic ResourceScope
ResourceScope.globalScope()
Returns an implicit scope which is assumed to be always alive.static ResourceScope
ResourceScope.newConfinedScope()
Create a new confined scope.static ResourceScope
ResourceScope.newConfinedScope
(Cleaner cleaner) Create a new confined scope managed by aCleaner
.static ResourceScope
ResourceScope.newImplicitScope()
Create a new implicit scope.static ResourceScope
ResourceScope.newSharedScope()
Create a new shared scope.static ResourceScope
ResourceScope.newSharedScope
(Cleaner cleaner) Create a new shared scope managed by aCleaner
.CLinker.VaList.scope()
Returns the resource scope associated with this instance.MemoryAddress.scope()
Returns the resource scope associated with this memory address.MemorySegment.scope()
Returns the resource scope associated with this memory segment.ResourceScope.Handle.scope()
Returns the resource scope associated with this handle.Modifier and TypeMethodDescriptionstatic MemorySegment
MemorySegment.allocateNative
(long bytesSize, long alignmentBytes, ResourceScope scope) Creates a new confined native memory segment that models a newly allocated block of off-heap memory with given size (in bytes), alignment constraint (in bytes) and resource scope.static MemorySegment
MemorySegment.allocateNative
(long bytesSize, ResourceScope scope) Creates a new confined native memory segment that models a newly allocated block of off-heap memory with given size (in bytes) and resource scope.static MemorySegment
MemorySegment.allocateNative
(MemoryLayout layout, ResourceScope scope) Creates a new confined native memory segment that models a newly allocated block of off-heap memory with given layout and resource scope.static SegmentAllocator
SegmentAllocator.arenaAllocator
(long size, ResourceScope scope) Returns a native arena-based allocator which allocates a single memory segment, of given size (using malloc), and then responds to allocation request by returning different slices of that same segment (until no further allocation is possible).static SegmentAllocator
SegmentAllocator.arenaAllocator
(ResourceScope scope) Returns a native unbounded arena-based allocator.MemoryAddress.asSegment
(long bytesSize, Runnable cleanupAction, ResourceScope scope) Returns a new native memory segment with given size and resource scope (replacing the scope already associated with this address), and whose base address is this address.MemoryAddress.asSegment
(long bytesSize, ResourceScope scope) Returns a new native memory segment with given size and resource scope (replacing the scope already associated with this address), and whose base address is this address.static CLinker.VaList
CLinker.VaList.make
(Consumer<CLinker.VaList.Builder> actions, ResourceScope scope) Constructs a newVaList
using a builder (seeCLinker.VaList.Builder
), associated with a given resource scope.static MemorySegment
MemorySegment.mapFile
(Path path, long bytesOffset, long bytesSize, FileChannel.MapMode mapMode, ResourceScope scope) Creates a new mapped memory segment that models a memory-mapped region of a file from a given path.static CLinker.VaList
CLinker.VaList.ofAddress
(MemoryAddress address, ResourceScope scope) Constructs a newVaList
instance out of a memory address pointing to an existing Cva_list
, with given resource scope.static SegmentAllocator
SegmentAllocator.ofScope
(ResourceScope scope) Returns a native allocator which responds to allocation requests by allocating new segments bound by the given resource scope, using theMemorySegment.allocateNative(long, long, ResourceScope)
factory.static MemorySegment
CLinker.toCString
(String str, ResourceScope scope) Converts a Java string into a UTF-8 encoded, null-terminated C string, storing the result into a native memory segment associated with the provided resource scope.CLinker.upcallStub
(MethodHandle target, FunctionDescriptor function, ResourceScope scope) Allocates a native stub with given scope which can be passed to other foreign functions (as a function pointer); calling such a function pointer from native code will result in the execution of the provided method handle.CLinker.VaList.vargAsSegment
(MemoryLayout layout, ResourceScope scope) Reads the next value as aMemorySegment
, and advances this va list's position.