[1662329 views]

[]

Odi's astoundingly incomplete notes

New entries | Code

Java 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.
posted on 2019-09-11 11:30 UTC in Code | 0 comments | permalink