Reputation: 4223
I am aware that JDK 7 is supposed to be a merger between hotspot and jrockit and that there will not be a jrockit 1.7. (Source: https://blogs.oracle.com/henrik/entry/java_7_questions_answers) I have a project that requires the non-contiguous heap feature of jrockit as well as some java 1.7 features, so since JDK 7 is a merger, does it support non-contiguous heap because I can't find an offical documentation which says so?
Upvotes: 0
Views: 1371
Reputation: 90013
I assume that you are asking about non-contiguous heaps because you are suffering from memory fragmentation. A lot of the time your 32-bit address space is fragmented, but your 64-bit address space is not. Meaning, if your computer has sufficient memory, using a 64-bit JVM will allow you to find contiguous memory that a 32-bit JVM will not. I have personally used a 64-bit JVM to allocate heaps over 4GB when a 32-bit JVM failed to allocate a heap over 2GB.
Although it doesn't look like arbitrary non-contiguous heaps made it into JDK 7, you can try using the G1 garbage collector. According to http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html:
The heap is partitioned into a set of equal-sized heap regions, each a contiguous range of virtual memory.
Theoretically speaking, this allows you to play with a non-contiguous heap. The only limitation is that the regions must be of equal size.
According to http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/G1GettingStarted/index.html#t6 you can use this command-line option to control the region size:
-XX:G1HeapRegionSize=n: With G1 the Java heap is subdivided into uniformly sized regions. This sets the size of the individual sub-divisions. The default value of this parameter is determined ergonomically based upon heap size. The minimum value is 1Mb and the maximum value is 32Mb.
I hope this helps.
Upvotes: 2