Skip to content

The debug allocator names the code holding the memory, and the leak it found is fixed: a check of the compiler holds 584 MB at its peak, was 933 (#618, #2407) - #3580

Merged
ehartford merged 2 commits into
mainfrom
alloc-sites
Nov 24, 2026
Merged

ehartford merged 2 commits into
mainfrom
alloc-sites

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Two commits.

1. The debug allocator names the code holding the memory (#618). WITH_DEBUG_ALLOC_SITES_AT=<n> prints, at allocation n (the peak report gives the number), the live blocks grouped by the call chain that allocated them, largest first. Chains are twelve frames deep.

2. The leak that report found (#2407). comptime_eval_finish handed the Sema back with a store through a raw pointer, which releases nothing, so the blank Sema standing in for it leaked once per compile-time evaluation. Each blank had also indexed every declaration of the program. The blank is now taken out before the store, and only Sema.init builds the index.

checking src/main.with before after
peak live bytes 933 MB 584 MB
live blocks at the peak 2,644,569 1,397,070
compiling stage peak RSS 1,804 MB 1,417 MB

Test: behav_2407_comptime_eval_releases_its_blank_sema (400 evaluations, 3,400 declarations, 64 MB limit) fails on main with "memory limit exceeded" and passes here. The tripwire limit is unchanged.

Evidence at 540ce6a: pre-checks green; battery GREEN (501 s); linux-aarch64 container leg green (:build, :behavior-tests, :debug-alloc-tests); :release-checks survey: all targets green.

Closes #618. Closes #2407.

Eric Hartford added 2 commits November 23, 2026 17:13
…e at a chosen allocation, grouped by the chain that allocated them (#618)
…r the one it took, and the blank indexes no declarations: a check of the compiler holds 584 MB at its peak, was 933 (#2407)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant