Direct buffers are no longer page aligned by default on Java 1.7

Hi

I have just read that direct buffers are no longer page aligned on Java 1.7:
http://download.java.net/jdk8/docs/technotes/guides/io/enhancements.html#jdk7

Is it possible to get the same behavior on Java 1.6 by using -XX:+PageAlignDirectMemory=false? Does it have a bad impact on performance when using big direct NIO buffers? Best regards.

FYI: the buffers are now 16 byte aligned, probably with (future) SIMD in mind.

Why would it affect performance? Very few applications care about memory pages. At worst it means 1 more cache miss when iterating through a buffer.

The tech notes don’t talk about any improvement for the big NIO buffers and there is still a flag to revert this change so I assume there might be a need of page alignment.

Do you know if -XX:+PageAlignDirectMemory=false works on Java 1.6? I don’t want to switch to Java 1.7 just to benefit of this improvement.

This change was not due to performance improvements. It’s solely there to reduce memory overhead.

Ofcourse not.

You’re right:

[quote]Buildfile: /home/gouessej/Documents/programmation/java/workspace/tuer/build.xml
run-tuer:
[java] Unrecognized VM option ‘+PageAlignDirectMemory=false’
[java] Could not create the Java virtual machine.

BUILD FAILED
/home/gouessej/Documents/programmation/java/workspace/tuer/build.xml:444: Java returned: 1

Total time: 3 seconds
[/quote]