JEP 316 was added to reserve the heap on a file device. It added an file descriptor argument to calls like os::reserve_memory and friends.
There are a number of issues with this:
- in os::reserve_memory_aligned, Posix: mmap is called to reserve, then the generic os::release_memory is called to release parts of it. Or all in case of an error.
- Same problem also in reserve_mmapped_memory() in the same file
- Comment states that mappings established with a file descriptor cannot be partially unmapped. Not sure if that is true. If it is untrue, that coding can be simplified a lot.