Skip to content

Comptime evaluator: 63 GB heap on the linux-sysroot action (StringBuilder per-byte values, no reclamation) #1944

Closed

Description

@ehartford

The comptime evaluator grows past 60 GB evaluating run_linux_sysroot_action (build/sdk.w, branch linux-own-sdk), and the kernel OOM-kills it.

Repro (eric-5090, linux-x86_64, branch linux-own-sdk):

WITH=$PWD/out/release/bin/with WITH_BUILD_ACTION_WORKER=linux-sysroot WITH_BUILD_ACTION_FORCE=1 \
  out/release/bin/with build :linux-sysroot --no-deps
# rc=137; kernel: Out of memory: Killed process (with) total-vm:63677292kB, anon-rss:63470244kB

The same action compiled by the native runner (out/.build-state/build-runner) finishes and writes a 10 MB pack. The action reads Zig's glibc abilists, writes about 165 files (about 10 MB), and assembles them into one StringBuilder.with_capacity(24000000). So the evaluator's heap runs at several thousand times the program's working set: a Vec[u8]-backed StringBuilder is interpreted one ComptimeValue per byte, and the evaluator heap is never freed until the function returns.

The driver said nothing at all. The serial evaluator-worker path (run_build_action_worker_process) did not report a worker's exit, so the survey printed failed: linux-sysroot with no reason. That half is fixed on linux-own-sdk: the driver now names a killed worker and its signal.

Expected: evaluating a build action costs memory proportional to what the action holds, or the evaluator fails loudly at a budget. Workaround: the native runner, which the driver uses once the bootstrap link root is this generation's.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions