Date: Thu, 23 Jul 2009 14:33:51 +0400 From: ArtemGr <artemciy@gmail.com> To: freebsd-java@freebsd.org Subject: file size growth on FileChannel.map Message-ID: <4A683C8F.3030608@gmail.com>
next in thread | raw e-mail | index | archive | help
When I use a FileChannel.map several times to map a large region into memory, the file size suddenly increase. The mapped region is always withing the file, e.g. always less than FileChannel.position! I monitored FileChannel.position and FileChannel.size: FileChannel.position stays the same, yet FileChannel.size increases after mapping. The file itself increases too, with the new space containing all zeroes. The increase is large, tens and hundreds of megabytes. I had my files grow to several gigabytes just by mmaping regions of them. I don't think it is an expected behaviour, AFAIK. FreeBSD mmap might return a larger portion of memory to match a page size, but it isn't supposed to grow the underlying file. Therefore I suspect it might be a bug in (FreeBSD version of) the JDK. I encountered the problem on 7.2-RELEASE amd64, openjdk version "1.6.0-internal", ZFS and 7.2-STABLE (May 25) amd64, java version "1.6.0_07", UFS2 Had anybody seen such behaviour from FileChannel.map? Am I right supposing it shouldn't grow the file? Should I investigate further?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A683C8F.3030608>