Uses of Interface
jdk.incubator.foreign.SegmentAllocator
Packages that use SegmentAllocator
Package
Description
Classes to support low-level and efficient foreign memory/function access, directly from Java.
-
Uses of SegmentAllocator in jdk.incubator.foreign
Methods in jdk.incubator.foreign that return SegmentAllocatorModifier and TypeMethodDescriptionstatic SegmentAllocatorSegmentAllocator.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 SegmentAllocatorSegmentAllocator.arenaAllocator(ResourceScope scope) Returns a native unbounded arena-based allocator.static SegmentAllocatorSegmentAllocator.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 SegmentAllocatorSegmentAllocator.ofSegment(MemorySegment segment) Returns a segment allocator which responds to allocation requests by recycling a single segment; that is, each new allocation request will return a new slice starting at the segment offset0(alignment constraints are ignored by this allocator).Methods in jdk.incubator.foreign with parameters of type SegmentAllocatorModifier and TypeMethodDescriptionCLinker.downcallHandle(Addressable symbol, SegmentAllocator allocator, MethodType type, FunctionDescriptor function) Obtain a foreign method handle, with the given type and featuring the given function descriptor, which can be used to call a target foreign function at the given address.static MemorySegmentCLinker.toCString(String str, SegmentAllocator allocator) Converts a Java string into a UTF-8 encoded, null-terminated C string, storing the result into a native memory segment allocated using the provided allocator.CLinker.VaList.vargAsSegment(MemoryLayout layout, SegmentAllocator allocator) Reads the next value as aMemorySegment, and advances this va list's position.