Skip to content

Commit 5b41cc1

Browse files
committed
[GR-46399] Set Xmx when building native images to use a reliable amount of memory
* Avoids using too much memory in CIs with non-isolated parallel runners (macOS). * It fails early if there is not enough memory available to build the image. * The value is chosen to be the lowest with still a good build time (not too many GCs): CE: Default (= all available memory at start of the build): 10.9s (5.8% of total time) in 81 GCs | Peak RSS: 10.47GB | CPU load: 6.19 [librubyvm:122028] Finished generating 'librubyvm' in 3m 8s. Xms6g: 8.1s (3.8% of total time) in 135 GCs | Peak RSS: 7.30GB | CPU load: 5.92 [librubyvm:106905] Finished generating 'librubyvm' in 3m 33s. second run: 8.4s (4.4% of total time) in 139 GCs | Peak RSS: 7.43GB | CPU load: 6.10 [librubyvm:124778] Finished generating 'librubyvm' in 3m 10s. Xms5g: 9.7s (5.1% of total time) in 157 GCs | Peak RSS: 6.45GB | CPU load: 6.06 [librubyvm:109471] Finished generating 'librubyvm' in 3m 11s. Xms4g: 31.5s (15.0% of total time) in 197 GCs | Peak RSS: 5.47GB | CPU load: 6.21 [librubyvm:113339] Finished generating 'librubyvm' in 3m 29s. Xms3g: [librubyvm:116953] GC warning: 100.7s spent in 254 GCs during the last stage, taking up 67.26% of the time. [librubyvm:116953] Please ensure more than 3.88GB of memory is available for Native Image [librubyvm:116953] to reduce GC overhead and improve image build time. EE: Xms6g: 18.8s (6.3% of total time) in 349 GCs | Peak RSS: 7.94GB | CPU load: 6.65 [librubyvm:138943] Finished generating 'librubyvm' in 5m 0s. Xms5g: 45.3s (13.0% of total time) in 483 GCs | Peak RSS: 6.72GB | CPU load: 7.04 [librubyvm:144618] Finished generating 'librubyvm' in 5m 48s.
1 parent 1ff8e6b commit 5b41cc1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mx.truffleruby/mx_truffleruby.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,14 @@ def verify_ci(args):
313313
jar_distributions=['truffleruby:TRUFFLERUBY-LAUNCHER'],
314314
main_class='org.truffleruby.launcher.RubyLauncher',
315315
build_args=[
316+
'-J-Xmx5g', # Set Xmx to use a reliable amount of memory
316317
'-H:+DumpThreadStacksOnSignal',
317318
'-H:+DetectUserDirectoriesInImageHeap',
318319
'-H:+TruffleCheckBlockListMethods'
319320
],
321+
build_args_enterprise=[
322+
'-J-Xmx6g', # Set Xmx to use a reliable amount of memory
323+
],
320324
language='ruby',
321325
option_vars=[
322326
'RUBYOPT',

0 commit comments

Comments
 (0)