Hi everyone, I tried asking this on the freebsd-java list too, but did not get a response, so trying here instead:
The code backing the `-XX:AllocateHeapAt=path` option to java calls the function posix_fallocate on most systems to reserve the space for the file in the file system. This will fail and return `EINVAL` if the underlying file system does not support the operation. On FreeBSD this is particularly relevant because the commonly used ZFS file system does not support this operation. For rationale see: https://freebsd-current.freebsd.narkive.com/5pbDPeIT/heads-up-posix-fallocate-support-removed-from-zfs-lld-affected https://lists.freebsd.org/pipermail/freebsd-current/2018-February/068447.html On OpenBSD the ftruncate function is used instead, and MacOSX will attempt to set the size via fcntl, but falls back to ftruncate if that does not work. To make things even more interesting, the glibc implementation of posix_fallocate used on most Linux based systems deviates from the posix standard by 'emulating' the feature if not supported by the underlying file system. https://www.man7.org/linux/man-pages/man3/posix_fallocate.3.html#CAVEATS My question is: Do we want to keep the strict posix compliance on FreeBSD, which in practice means this feature is not supported on ZFS, or do we want to be less strict like the other platforms mentioned above? Also, if someone can comment on the rationale for OpenBSD implementation, that would also be helpful. Thanks in advance, Harald Eilertsen
