You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[GR-67680] Clearer Native Image output for how much memory it uses
* Example outputs:
15.00GiB of memory (93.8% of system memory, using all available memory)
15.00GiB of memory (93.8% of system memory, using all available memory, user flags: '-Xms4g')
29.80GiB of memory (46.6% of system memory, capped at 32GB)
13.60GiB of memory (85% of system memory because $CI set to 'true')
13.60GiB of memory (85% of system memory because in container)
13.60GiB of memory (85% of system memory because less than 8GiB available)
9.00GiB of memory (56.3% of system memory, set via '-Xmx9g')
8.00GiB of memory (50.0% of system memory, set via '-XX:MaxRAMPercentage=25 -Xms5g -Xmx8g -Xms6g')
Co-Authored-By: Betty Mann <[email protected]>
Co-Authored-By: Paul Wögerer <[email protected]>
3,158 types, 3,625 fields, and 14,804 methods found reachable
@@ -143,11 +143,13 @@ The memory limit and number of threads used by the build process.
143
143
144
144
More precisely, the memory limit of the Java heap, so actual memory consumption can be higher.
145
145
Please check the [peak RSS](#glossary-peak-rss) reported at the end of the build to understand how much memory was actually used.
146
-
By default, the build process uses the dedicated mode (up to 85% of system memory) in containers or CI environments (when the `$CI` environment variable is set to `true`), but never more than 32GB of memory.
147
-
Otherwise, it tries to use available memory to avoid memory pressure on developer machines (shared mode).
146
+
The actual memory consumption can also be lower than the limit set, as the GC only commits memory that it needs.
147
+
By default, the build process uses the dedicated mode (which uses 85% of system memory) in containers or CI environments (when the `$CI` environment variable is set to `true`), but never more than 32GB of memory.
148
+
Otherwise, it uses shared mode, which uses the available memory to avoid memory pressure on developer machines.
148
149
If less than 8GB of memory are available, the build process falls back to the dedicated mode.
149
150
Therefore, consider freeing up memory if your machine is slow during a build, for example, by closing applications that you do not need.
150
151
It is possible to override the default behavior and set relative or absolute memory limits, for example with `-J-XX:MaxRAMPercentage=60.0` or `-J-Xmx16g`.
152
+
`Xms` (for example, `-J-Xms9g`) can also be used to ensure a minimum for the limit, if you know the image needs at least that much memory to build.
151
153
152
154
By default, the build process uses all available processors to maximize speed, but not more than 32 threads.
153
155
Use the `--parallelism` option to set the number of threads explicitly (for example, `--parallelism=4`).
if (availableMemorySize >= MIN_AVAILABLE_MEMORY_THRESHOLD_GB * GiB_TO_BYTES) {
131
+
reason = percentageOfSystemMemoryText(availableMemorySize, totalMemorySize) + ", using all available memory";
132
+
maxMemory = availableMemorySize;
128
133
} else { // fall back to dedicated mode
129
-
memoryUsageReason = "less than " + MIN_AVAILABLE_MEMORY_THRESHOLD_GB + "GB of memory available";
130
-
reasonableMaxMemorySize = dedicatedMemorySize;
134
+
reason = "85%% of system memory because less than %dGiB available".formatted(MIN_AVAILABLE_MEMORY_THRESHOLD_GB);
135
+
maxMemory = dedicatedMemorySize;
131
136
}
132
137
}
133
138
134
-
if (reasonableMaxMemorySize < MIN_HEAP_BYTES) {
139
+
if (maxMemory < MIN_HEAP_BYTES) {
135
140
thrownewNativeImageError(
136
141
"There is not enough memory available on the system (got %sMiB, need at least %sMiB). Consider freeing up memory if builds are slow, for example, by closing applications that you do not need."
0 commit comments