Skip to content

Commit d0142f3

Browse files
committed
MaxRAM Obsolete
1 parent d02ac57 commit d0142f3

File tree

7 files changed

+25
-61
lines changed

7 files changed

+25
-61
lines changed

src/hotspot/share/gc/shared/gc_globals.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,18 +269,13 @@
269269
product(bool, AlwaysActAsServerClassMachine, false, \
270270
"(Deprecated) Always act like a server-class machine") \
271271
\
272-
product(uint64_t, MaxRAM, 0, \
273-
"(Deprecated) Real memory size (in bytes) used to set maximum " \
274-
"heap size") \
275-
range(0, 0XFFFFFFFFFFFFFFFF) \
276-
\
277272
product(bool, AggressiveHeap, false, \
278273
"(Deprecated) Optimize heap options for long-running memory " \
279274
"intensive apps") \
280275
\
281276
product(size_t, ErgoHeapSizeLimit, 0, \
282277
"Maximum ergonomically set heap size (in bytes); zero means use " \
283-
"MaxRAM * MaxRAMPercentage / 100") \
278+
"(System RAM) * MaxRAMPercentage / 100") \
284279
range(0, max_uintx) \
285280
\
286281
product(double, MaxRAMPercentage, 25.0, \

src/hotspot/share/runtime/arguments.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
#include "utilities/align.hpp"
6767
#include "utilities/debug.hpp"
6868
#include "utilities/defaultStream.hpp"
69+
#include "utilities/globalDefinitions.hpp"
6970
#include "utilities/macros.hpp"
7071
#include "utilities/parseInteger.hpp"
7172
#include "utilities/powerOfTwo.hpp"
@@ -538,7 +539,6 @@ static SpecialFlag const special_jvm_flags[] = {
538539
#endif
539540
{ "ParallelRefProcEnabled", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
540541
{ "ParallelRefProcBalancingEnabled", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
541-
{ "MaxRAM", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
542542
{ "AggressiveHeap", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
543543
{ "NeverActAsServerClassMachine", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
544544
{ "AlwaysActAsServerClassMachine", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
@@ -553,6 +553,7 @@ static SpecialFlag const special_jvm_flags[] = {
553553
#endif
554554

555555
{ "PSChunkLargeArrays", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
556+
{ "MaxRAM", JDK_Version::jdk(26), JDK_Version::jdk(27), JDK_Version::jdk(28) },
556557

557558
#ifdef ASSERT
558559
{ "DummyObsoleteTestFlag", JDK_Version::undefined(), JDK_Version::jdk(18), JDK_Version::undefined() },
@@ -1510,25 +1511,19 @@ void Arguments::set_heap_size() {
15101511
// Check if the user has configured any limit on the amount of RAM we may use.
15111512
bool has_ram_limit = !FLAG_IS_DEFAULT(MaxRAMPercentage) ||
15121513
!FLAG_IS_DEFAULT(MinRAMPercentage) ||
1513-
!FLAG_IS_DEFAULT(InitialRAMPercentage) ||
1514-
!FLAG_IS_DEFAULT(MaxRAM);
1514+
!FLAG_IS_DEFAULT(InitialRAMPercentage);
15151515

1516-
if (FLAG_IS_DEFAULT(MaxRAM)) {
1517-
if (CompilerConfig::should_set_client_emulation_mode_flags()) {
1518-
// Limit the available memory if client emulation mode is enabled.
1519-
FLAG_SET_ERGO(MaxRAM, 1ULL*G);
1520-
} else {
1521-
// Use the available physical memory on the system.
1522-
FLAG_SET_ERGO(MaxRAM, os::physical_memory());
1523-
}
1524-
}
1516+
// Limit the available memory if client emulation mode is enabled.
1517+
const size_t phys_mem = CompilerConfig::should_set_client_emulation_mode_flags()
1518+
? 1ULL*G
1519+
: os::physical_memory();
15251520

15261521
// If the maximum heap size has not been set with -Xmx, then set it as
15271522
// fraction of the size of physical memory, respecting the maximum and
15281523
// minimum sizes of the heap.
15291524
if (FLAG_IS_DEFAULT(MaxHeapSize)) {
1530-
uint64_t min_memory = (uint64_t)(((double)MaxRAM * MinRAMPercentage) / 100);
1531-
uint64_t max_memory = (uint64_t)(((double)MaxRAM * MaxRAMPercentage) / 100);
1525+
uint64_t min_memory = (uint64_t)(((double)phys_mem * MinRAMPercentage) / 100);
1526+
uint64_t max_memory = (uint64_t)(((double)phys_mem * MaxRAMPercentage) / 100);
15321527

15331528
const size_t reasonable_min = clamp_by_size_t_max(min_memory);
15341529
size_t reasonable_max = clamp_by_size_t_max(max_memory);
@@ -1615,7 +1610,7 @@ void Arguments::set_heap_size() {
16151610
reasonable_minimum = limit_heap_by_allocatable_memory(reasonable_minimum);
16161611

16171612
if (InitialHeapSize == 0) {
1618-
uint64_t initial_memory = (uint64_t)(((double)MaxRAM * InitialRAMPercentage) / 100);
1613+
uint64_t initial_memory = (uint64_t)(((double)phys_mem * InitialRAMPercentage) / 100);
16191614
size_t reasonable_initial = clamp_by_size_t_max(initial_memory);
16201615
reasonable_initial = limit_heap_by_allocatable_memory(reasonable_initial);
16211616

src/java.base/share/man/java.md

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,8 +2454,8 @@ Java HotSpot VM.
24542454

24552455
[`-XX:InitialRAMPercentage=`]{#-XX_InitialRAMPercentage}*percent*
24562456
: Sets the initial amount of memory that the JVM will use for the Java heap
2457-
before applying ergonomics heuristics as a percentage of the maximum amount
2458-
determined as described in the `-XX:MaxRAM` option.
2457+
before applying ergonomics heuristics as a percentage of the available memory
2458+
to the JVM process.
24592459

24602460
The following example shows how to set the percentage of the initial
24612461
amount of memory used for the Java heap:
@@ -2575,9 +2575,8 @@ Java HotSpot VM.
25752575

25762576
[`-XX:MaxRAMPercentage=`]{#-XX_MaxRAMPercentage}*percent*
25772577
: Sets the maximum amount of memory that the JVM may use for the Java heap
2578-
before applying ergonomics heuristics as a percentage of the maximum amount
2579-
determined as described in the `-XX:MaxRAM` option. The default value is 25
2580-
percent.
2578+
before applying ergonomics heuristics as a percentage of the available
2579+
memory to the JVM process. The default value is 25 percent.
25812580

25822581
Specifying this option disables automatic use of compressed oops if
25832582
the combined result of this and other options influencing the maximum amount
@@ -2591,9 +2590,9 @@ Java HotSpot VM.
25912590

25922591
[`-XX:MinRAMPercentage=`]{#-XX_MinRAMPercentage}*percent*
25932592
: Sets the maximum amount of memory that the JVM may use for the Java heap
2594-
before applying ergonomics heuristics as a percentage of the maximum amount
2595-
determined as described in the `-XX:MaxRAM` option for small heaps. A small
2596-
heap is a heap of approximately 125 MB. The default value is 50 percent.
2593+
before applying ergonomics heuristics as a percentage of the available memory
2594+
to the JVM process for small heaps. A small heap is a heap of approximately
2595+
125 MB. The default value is 50 percent.
25972596

25982597
The following example shows how to set the percentage of the maximum amount
25992598
of memory used for the Java heap for small heaps:
@@ -2939,25 +2938,6 @@ they're used.
29392938
(`-XX:+UseParallelGC` or `-XX:+UseG1GC`). Other collectors employing multiple
29402939
threads always perform reference processing in parallel.
29412940

2942-
[`-XX:MaxRAM=`]{#-XX_MaxRAM}*size*
2943-
: Sets the maximum amount of memory that the JVM may use for the Java heap
2944-
before applying ergonomics heuristics. The default value is the amount of
2945-
available memory to the JVM process.
2946-
2947-
The maximum amount of available memory to the JVM process is the minimum
2948-
of the machine's physical memory and any constraints set by the environment
2949-
(e.g. container).
2950-
2951-
Specifying this option disables automatic use of compressed oops if
2952-
the combined result of this and other options influencing the maximum amount
2953-
of memory is larger than the range of memory addressable by compressed oops.
2954-
See `-XX:UseCompressedOops` for further information about compressed oops.
2955-
2956-
The following example shows how to set the maximum amount of available
2957-
memory for sizing the Java heap to 2 GB:
2958-
2959-
> `-XX:MaxRAM=2G`
2960-
29612941
[`-XX:+AggressiveHeap`]{#-XX__AggressiveHeap}
29622942
: Enables Java heap optimization. This sets various parameters to be
29632943
optimal for long-running jobs with intensive memory allocation, based on
@@ -2967,8 +2947,8 @@ they're used.
29672947
[`-XX:+NeverActAsServerClassMachine`]{#-XX__NeverActAsServerClassMachine}
29682948
: Enable the "Client VM emulation" mode which only uses the C1 JIT compiler,
29692949
a 32Mb CodeCache and the Serial GC. The maximum amount of memory that the
2970-
JVM may use (controlled by the `-XX:MaxRAM=n` flag) is set to 1GB by default.
2971-
The string "emulated-client" is added to the JVM version string.
2950+
JVM may use is set to 1GB by default. The string "emulated-client" is added
2951+
to the JVM version string.
29722952

29732953
By default the flag is set to `true` only on Windows in 32-bit mode and
29742954
`false` in all other cases.

test/hotspot/gtest/runtime/test_globals.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ TEST_VM(FlagGuard, size_t_flag) {
5757
TEST_FLAG(HeapSizePerGCThread, size_t, 1337);
5858
}
5959

60-
TEST_VM(FlagGuard, uint64_t_flag) {
61-
TEST_FLAG(MaxRAM, uint64_t, 1337);
62-
}
63-
6460
TEST_VM(FlagGuard, double_flag) {
6561
TEST_FLAG(CompileThresholdScaling, double, 3.141569);
6662
}

test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@
5050

5151
public class TestUseCompressedOopsFlagsWithUlimit {
5252

53-
private static void checkFlag(long ulimit, long maxram, int maxrampercent, boolean expectcoop) throws Exception {
53+
private static void checkFlag(long ulimit, int maxrampercent, boolean expectcoop) throws Exception {
5454

5555
ArrayList<String> args = new ArrayList<String>();
56-
args.add("-XX:MaxRAM=" + maxram);
5756
args.add("-XX:MaxRAMPercentage=" + maxrampercent);
5857
args.add("-XX:+PrintFlagsFinal");
5958

@@ -92,9 +91,9 @@ public static void main(String args[]) throws Exception {
9291

9392
long oneG = 1L * 1024L * 1024L * 1024L;
9493

95-
// Args: ulimit, max_ram, max_ram_percent, expected_coop
94+
// Args: ulimit, max_ram_percent, expected_coop
9695
// Setting MaxRAMPercentage explicitly to make the test more resilient.
97-
checkFlag(10 * oneG, 32 * oneG, 100, true);
98-
checkFlag(10 * oneG, 128 * oneG, 100, true);
96+
checkFlag(10 * oneG, 100, true);
97+
checkFlag(10 * oneG, 100, true);
9998
}
10099
}

test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ public static void main(String[] args) throws Exception {
237237
excludeTestMaxRange("G1ConcRefinementThreads");
238238
excludeTestMaxRange("InitialHeapSize");
239239
excludeTestMaxRange("MaxHeapSize");
240-
excludeTestMaxRange("MaxRAM");
241240
excludeTestMaxRange("NewSize");
242241
excludeTestMaxRange("ParallelGCThreads");
243242
excludeTestMaxRange("TLABSize");

test/lib-test/jdk/test/whitebox/vm_flags/Uint64Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*/
3636

3737
public class Uint64Test {
38-
private static final String FLAG_NAME = "MaxRAM";
38+
private static final String FLAG_NAME = "StringDeduplicationHashSeed";
3939
private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE,
4040
-1L, Long.MAX_VALUE, Long.MIN_VALUE};
4141

0 commit comments

Comments
 (0)