spring-boot-demo-oom: five real memory-leak demos with captured OOM + MAT evidence
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Drives unbounded-queue-leak to a REAL java.lang.OutOfMemoryError under a constrained heap, with
|
||||
# -XX:+HeapDumpOnOutOfMemoryError so the crash leaves a real .hprof behind. Also regenerates
|
||||
# docs/output/01-oom-console.txt from the real run log.
|
||||
#
|
||||
# Needs JDK 25 (LTS) on PATH.
|
||||
set -eu
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
MODULE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
ROOT_DIR="$(cd "$MODULE_DIR/.." && pwd)"
|
||||
cd "$MODULE_DIR"
|
||||
|
||||
mvn -q -B package -DskipTests
|
||||
mkdir -p docs/output
|
||||
rm -f docs/output/heap.hprof
|
||||
CMD="java -Xmx160m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=docs/output/heap.hprof -jar target/unbounded-queue-leak.jar"
|
||||
echo "== running: $CMD =="
|
||||
LOG="$(mktemp)"
|
||||
$CMD > "$LOG" 2>&1 || true
|
||||
python3 "$ROOT_DIR/scripts/extract-oom-console.py" "$MODULE_DIR" "$LOG" "$CMD"
|
||||
rm -f "$LOG"
|
||||
echo "heap dump: docs/output/heap.hprof (not committed -- see .gitignore; regenerate it with this script)"
|
||||
Reference in New Issue
Block a user