From c240b7b8441eb004d5a9fe1e7763fa5a5d8fb77f Mon Sep 17 00:00:00 2001 From: Ivo Horak Date: Sun, 29 Nov 2026 05:06:30 +0100 Subject: [PATCH] Compile in the main isolate in the native standalone Truffle compilations of the native standalone run in a separate isolate by default. That isolate has its own heap, which starts with a young generation of about 48 MB that is touched before its first collection, and it maps and touches the image heap a second time. Compile in the main isolate instead; the compiler's allocations then share the main heap and its young generation. --vm.XX:+CompileInIsolates restores the separate isolate per process. --- mx.graalpython/mx_graalpython.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mx.graalpython/mx_graalpython.py b/mx.graalpython/mx_graalpython.py index f2e85d7998..30607eb510 100644 --- a/mx.graalpython/mx_graalpython.py +++ b/mx.graalpython/mx_graalpython.py @@ -527,6 +527,12 @@ def libpythonvm_build_args(): # MAP_JIT memory is mapped next to the (ASLR-slid) dylibs. build_args += ['-H:-RandomizeRuntimeCodeCache'] + if not graalos and not _is_overridden_native_image_arg("-R:+CompileInIsolates") and not _is_overridden_native_image_arg("-R:-CompileInIsolates"): + # Runtime compilation runs in a separate isolate by default, with its own heap (which starts + # with a young generation of about 48 MB) and a second mapping of the image heap that it + # touches. Compile in the main isolate instead; --vm.XX:+CompileInIsolates restores it. + build_args += ['-R:-CompileInIsolates'] + profile = None require_profile = get_boolean_env("GRAALPY_REQUIRE_PGO_PROFILE") if (