Odi's astoundingly incomplete notes
New entries | CodeJava and its use of mmap
These are the syscalls caused by Java's mapped byte buffers:
FileChannel fc = FileChannel.open(f.toPath(), StandardOpenOption.READ, StandardOpenOption.WRITE); // mmap(NULL, 2147483647, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0) MappedByteBuffer buf = fc.map(MapMode.READ_WRITE, 0, Integer.MAX_VALUE); // madvise(0x7f4294000000, 2147483647, MADV_WILLNEED) = 0 buf.load();When the buffer is garbage collected the
munmap
call happens.Add comment