Feedback requested: Support for -XX:AllocateHeapAt on ZFS?
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Jun 2025 12:21:02 UTC
Hi, The code backing the `-XX:AllocateHeapAt=path` option to java calls the function posix_fallocate 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 OpenBSD is using the ftruncate function instead, which does not give the same guarantees as posix_fallocate. Likewise 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, 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? With the typical file system sizes of today, I don't think there should be any big dangers of using a less strict approach, but I'd like to hear others thought on the subject. Take care! Harald