Skip to content

Commit b8e6745

Browse files
Developerclaude
andcommitted
fix(devcontainer): configure jvm memory limits to prevent oom kills
- reduce MAVEN_OPTS from 2GB to 1GB to allow room for Spring Boot - add SPRING_JVM_ARGS (1GB) for explicit Spring Boot JVM control - lower JAVA_TOOL_OPTIONS MaxRAMPercentage from 50% to 25% - update run.sh to pass memory settings to spring-boot:run This prevents OOM kills when Maven compiler and Spring Boot JVM run simultaneously during development. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0f29a19 commit b8e6745

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,12 @@
8181
// Playwright browsers are pre-installed in the Docker image
8282
"PLAYWRIGHT_BROWSERS_PATH": "/home/vscode/.cache/ms-playwright",
8383
// JVM Performance Optimizations
84-
"MAVEN_OPTS": "-Xmx2g -XX:+UseG1GC -XX:+UseStringDeduplication",
85-
"JAVA_TOOL_OPTIONS": "-XX:+UseContainerSupport -XX:MaxRAMPercentage=50.0",
84+
// MAVEN_OPTS: Maven compiler JVM (1GB to allow room for Spring Boot)
85+
// SPRING_JVM_ARGS: Spring Boot application JVM (1GB default, override as needed)
86+
// JAVA_TOOL_OPTIONS: Fallback for all Java processes (conservative 25%)
87+
"MAVEN_OPTS": "-Xmx1g -XX:+UseG1GC -XX:+UseStringDeduplication",
88+
"SPRING_JVM_ARGS": "-Xmx1g -XX:+UseG1GC",
89+
"JAVA_TOOL_OPTIONS": "-XX:+UseContainerSupport -XX:MaxRAMPercentage=25.0",
8690
// Node.js Memory Optimization (2GB for 4GB RAM container)
8791
"NODE_OPTIONS": "--max-old-space-size=2048",
8892
// Bash history persistence

apps/backend/run.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,15 @@ fi
4949

5050
ensure_java
5151

52+
# Memory settings for development
53+
# MAVEN_OPTS controls the Maven JVM (compilation)
54+
# spring-boot.run.jvmArguments controls the Spring Boot application JVM
55+
export MAVEN_OPTS="${MAVEN_OPTS:--Xmx1g -XX:+UseG1GC}"
56+
SPRING_JVM_ARGS="${SPRING_JVM_ARGS:--Xmx1g -XX:+UseG1GC}"
57+
5258
# Run Spring Boot application (use mvn if mvnw not available)
5359
if [ -f ./mvnw ]; then
54-
./mvnw spring-boot:run
60+
./mvnw spring-boot:run -Dspring-boot.run.jvmArguments="$SPRING_JVM_ARGS"
5561
else
56-
mvn spring-boot:run
62+
mvn spring-boot:run -Dspring-boot.run.jvmArguments="$SPRING_JVM_ARGS"
5763
fi

0 commit comments

Comments
 (0)