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 Classes
    Modifier and Type
    Interface
    Description
    static class 
    A convenience class that implements a default implementation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Create Default as static member.
  • Method Summary

    Modifier and Type
    Method
    Description
    request(long newByteSize)
    Request a new heap MemorySegment with the given newByteSize.
    default void
    Request to close the given MemorySegment.
  • Field Details

  • Method Details

    • request

      default MemorySegment request(long newByteSize)
      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

      default void requestClose(MemorySegment prevSeg)
      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.