我正在比较Amazon Correto和Oracle的JRE(Windows 32位),发现它们分配的最大内存不同。
所以,我做了这个示例代码,并在不同的JRE上运行它。结果:
Amazon Corretto 32位-jre1.8.0_202
Amazon Corretto 64位-jre1.8.0_202
Oracle 32位-jre1.8.0_202
Oracle 64位-jre1.8.0_202
代码如下:
public class Main {
/**
* @param args
*/
public static void main( String[] args ) {
System.out.println( "Runtime.getRuntime().maxMemory(): " + Runtime.getRuntime().maxMemory() ); // JOSE_RENATO Remover
}
}
那么,为什么在使用-Xmx参数时Oracle的JRE 32位分配更多的内存?
而且,为什么这种行为在64位版本上有所不同?