BUG: withOwnerThread closes MappedMemorySegment
Ty Young
youngty1997 at gmail.com
Wed Sep 23 02:06:23 UTC 2020
A bug seems to have been introduced wherein using withOwnerThread causes
a MappedMemorySegment to close:
File file = new File("./test");
if(file.exists())
file.delete();
file.createNewFile();
MappedMemorySegment nativeFile =
MemorySegment.mapFromPath(file.toPath(), 0, 4096,
FileChannel.MapMode.READ_WRITE);
System.out.println(nativeFile.isAlive());
MappedMemorySegment segment =
(MappedMemorySegment)nativeFile.asSlice(4);
segment = (MappedMemorySegment)nativeFile.asSlice(4);
segment =
(MappedMemorySegment)nativeFile.asSlice(4).withOwnerThread(null);
System.out.println(nativeFile.isAlive());
System.out.println(segment.isAlive());
which prints true, false, and then true. The original
MappedMemorySegment was never closed, so this is unexpected.
More information about the panama-dev
mailing list