Interface Reallocator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Reallocator
ofAuto()
default MemorySegment
reallocate
(MemorySegment segment, long byteSize) Likereallocate(MemorySegment, long, long)
but thebyteAlignment
is taken fromsegment.maxByteAlignment()
.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)
-
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 taken fromsegment.maxByteAlignment()
. -
ofAuto
-
usingArena
-
usingAllocator
-