Interface Reallocator

All Known Implementing Classes:
Reallocator.AlignedReallocator
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Reallocator
  • Method Details

    • reallocate

      MemorySegment reallocate(MemorySegment segment, long byteSize, long byteAlignment)
      Reallocates the given segment to be the specified size. Upon returning, the original segment may be invalid.
      Parameters:
      segment - the segment to reallocate. This must be either MemorySegment.NULL or the return value of a prior invocation to this method on the same Reallocator instance.
      byteSize - the size (in bytes) of the reallocated segment
      byteAlignment - the alignment (in bytes) of the reallocated segment
      Returns:
      the new segment
    • reallocate

      default MemorySegment reallocate(MemorySegment segment, long byteSize)
      Like reallocate(MemorySegment, long, long) but the byteAlignment is at least 1. This alignment may be increased by a particular Reallocator implementation).
    • withAlignment

      default Reallocator withAlignment(long byteAlignment)
    • ofAuto

      static Reallocator ofAuto()
    • usingArena

      static Reallocator usingArena(Arena arena)
    • usingAllocator

      static Reallocator usingAllocator(SegmentAllocator allocator)