Interface MemorySegmentRequest
- All Known Implementing Classes:
MemorySegmentRequest.Default, MemorySegmentRequestExample
public interface MemorySegmentRequest
This is a callback interface to provide a means to request a new MemorySegment of a specified size.
- Author:
- Lee Rhodes
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA convenience class that implements a default implementation. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MemorySegmentRequest.DefaultCreate Default as static member. -
Method Summary
Modifier and TypeMethodDescriptiondefault MemorySegmentrequest(long newByteSize) Request a new heap MemorySegment with the given newByteSize.default voidrequestClose(MemorySegment prevSeg) Request to close the given MemorySegment.
-
Field Details
-
DEFAULT
Create Default as static member.
-
-
Method Details
-
request
Request a new heap MemorySegment with the given newByteSize. Because we do not have a reference to an Arena, the default here is to allocate a new MemorySegment on the heap. It is up to the user to override this as appropriate.- Parameters:
newByteSize- The new byteSize being requested.- Returns:
- new MemorySegment with the requested byteSize.
-
requestClose
Request to close the given MemorySegment. Because we do not have a reference to an Arena, the default here is to do nothing. It is up to the user to override this as appropriate.- Parameters:
prevSeg- the previous MemorySegment to be closed.
-