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.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Reallocator
ofAuto()
default MemorySegment
reallocate
(MemorySegment segment, long byteSize) reallocate
(MemorySegment segment, long byteSize, long byteAlignment) Reallocates the given segment to be the specified size.static Reallocator
usingAllocator
(SegmentAllocator allocator) static Reallocator
usingArena
(Arena arena) default Reallocator
withAlignment
(long byteAlignment)
-
Method Details
-
reallocate
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 eitherMemorySegment.NULL
or the return value of a prior invocation to this method on the sameReallocator
instance.byteSize
- the size (in bytes) of the reallocated segmentbyteAlignment
- the alignment (in bytes) of the reallocated segment- Returns:
- the new segment
-
reallocate
Likereallocate(MemorySegment, long, long)
but thebyteAlignment
is at least1
. This alignment may be increased by a particularReallocator
implementation). -
withAlignment
-
ofAuto
-
usingArena
-
usingAllocator
-