RFR: JDK-8028628 - java/nio/channels/FileChannel/Size.java failed once in the same binary run

Alan Bateman Alan.Bateman at oracle.com
Thu Nov 21 19:51:28 UTC 2013

On 21/11/2013 17:02, Dan Xu wrote:
> Hi Alan,
> I think the map is used to enlarge the size of the largeFile to 
> testSize + 10. In initTestFile(), it initiates the file with size 10. 
> My understanding is that it avoids writing large amount of data into 
> the largeFile by using the map. Thanks!
> -Dan
Okay, I guess I was really just wondering about the reliability on 
Windows as sometimes tests that use memory mapped files are troublesome 
when it comes to clean-up after the test. Also as this test hasn't run 
on Windows before then I wonder about how long initTestFile will take to 
create the 4GB file. You've probably measured already but if you need a 
speed up then you could change initTestFile to use a FIleChannel and 
create the file with the SPARSE option. Then just position to size-1 and 
write 1 byte. That should be faster than writing "e" 4 billion times.


More information about the core-libs-dev mailing list