build: recalibrate asan per-job memory budget 1536MB -> 512MB

The original 1536MB/job figure was calibrated around two memory hogs that
the build/de-nix work has since removed: the 293MB-peak serial capnp
compile (now compiled once via libxce_dep) and the 17 scheduler test
executables each statically linking all of scheduler_srcs (now one shared
sched_srcs_lib archive; link peaks ~125-150MB with -g1). Measured per-job
compile RSS ceiling post-dedup is ~125-150MB; 512MB keeps ~3x headroom
while letting an 8GB box run ~8 concurrent compiles instead of 2-3
(t1: mem_jobs goes from ~2-3 to ~9, so the -l ceiling becomes CPU-bound
rather than memory-bound).

SKILL.md's hand-computed formula is updated to match.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
lei.chen 2026-10-21 15:38:46 +00:00
parent e723c9c234
commit 28ccf8d35c
2 changed files with 12 additions and 2 deletions

View file

@ -157,6 +157,16 @@ else
# discounting nproc-minus-load-average for the compiler driver's forked
# cc1/cc1plus + as children (asan/debug keep those resident far longer
# than release's leaner ones).
#
# asan's 512MB budget (build/de-nix): the two memory hogs the original
# 1536MB figure was calibrated around are both gone -- the 293MB-peak
# serial capnp compile (批1: now compiled once, still far below the old
# budget) and the 17 scheduler test executables each statically linking
# all of scheduler_srcs (批2: shared sched_srcs_lib, link is the only
# heavy step and lld/ld peak ~125-150MB with -g1 debug info). Measured
# per-job RSS ceiling on t1 post-dedup is ~125-150MB; 512MB leaves ~3x
# headroom for a future pathological TU while letting an 8GB box run ~8
# concurrent compiles instead of 2-3.
default_nproc="$(nproc --all 2>/dev/null || echo 1)"
default_mem_mb="$(awk '/MemAvailable/ {print int($2/1024)}' /proc/meminfo 2>/dev/null)"
default_load="$(cut -d' ' -f1 /proc/loadavg 2>/dev/null)"
@ -164,7 +174,7 @@ else
: "${default_load:=0}"
case "$PROFILE" in
asan) default_per_job_mb=1536; default_process_factor=0.5 ;;
asan) default_per_job_mb=512; default_process_factor=0.5 ;;
debug) default_per_job_mb=1024; default_process_factor=0.5 ;;
release) default_per_job_mb=1024; default_process_factor=0.7 ;;
esac