Details
-
Bug
-
Resolution: Fixed
-
P2
-
21
-
b25
-
Verified
Description
There is an obvious bug in the for AbstractMemorySegment::reinterpret(long, Arena, Consumer):
@Override
@CallerSensitive
public final MemorySegment reinterpret(long newSize, Arena arena, Consumer<MemorySegment> cleanup) {
Objects.requireNonNull(arena);
return reinterpretInternal(Reflection.getCallerClass(), newSize,
MemorySessionImpl.toMemorySession(arena), null); // <------------ note the null here
}
The cleanup is not passed to the "internal" function. As a result, no cleanup function will be called when the segment is closed.
@Override
@CallerSensitive
public final MemorySegment reinterpret(long newSize, Arena arena, Consumer<MemorySegment> cleanup) {
Objects.requireNonNull(arena);
return reinterpretInternal(Reflection.getCallerClass(), newSize,
MemorySessionImpl.toMemorySession(arena), null); // <------------ note the null here
}
The cleanup is not passed to the "internal" function. As a result, no cleanup function will be called when the segment is closed.
Attachments
Issue Links
- duplicates
-
JDK-8309051 MemorySegment::reinterpret() not invoking cleanup.
-
- Closed
-