23 lines
940 B
Bash
Executable File
23 lines
940 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Drives static-cache-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/static-cache-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)"
|