From 8c2894febb87c38c1fd62dc97a528f3dd9192498 Mon Sep 17 00:00:00 2001 From: Christian Weichel Date: Tue, 3 Aug 2021 09:49:33 +0000 Subject: [PATCH] [supervisor] Set JAVA_TOOL_OPTIONS to curb RAM --- components/supervisor/pkg/supervisor/supervisor.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/supervisor/pkg/supervisor/supervisor.go b/components/supervisor/pkg/supervisor/supervisor.go index e218a37aa9bd29..65feecb2e33e37 100644 --- a/components/supervisor/pkg/supervisor/supervisor.go +++ b/components/supervisor/pkg/supervisor/supervisor.go @@ -615,6 +615,9 @@ func buildChildProcEnv(cfg *Config) []string { envs["HOME"] = "/home/gitpod" envs["USER"] = "gitpod" + // Particular Java optimisation: Java pre v10 did not gauge it's available memory correctly, and needed explicitly setting "-Xmx" for all Hotspot/openJDK VMs + envs["JAVA_TOOL_OPTIONS"] += fmt.Sprintf(" -Xmx%sm", os.Getenv("GITPOD_MEMORY")) + var env, envn []string for nme, val := range envs { log.WithField("envvar", nme).Debug("passing environment variable to IDE")