You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
InternPool and AstPool are Copy handles over raw allocations that nothing frees: every init leaks (the LSP leaks 1 MB per reparse) #2449
InternPool and AstPool are impl Copy handles over raw with_alloc blocks (src/InternPool.w:86, src/Ast.w:829): a 256-byte state block, two HashMaps, and an InternStringArena whose first page is 1 MB (INTERN_PAGE_SIZE, src/InternPool.w:37,45). No Drop, no free, no owner: every InternPool.init() leaks by construction, and the language cannot see it because the handle is a Copy wrapper built in unsafe library-tier code. The mission says leaking is a defect that must take deliberate, visible effort; here freeing is impossible and leaking takes none.
Where it bites today
src/Lsp.w:473LspDocument.ensure_parsed calls InternPool.init() on every reparse of an open document, and LspDocument.new creates two more (fast_intern, cached_intern, lines 453/457), plus AstPool.new() each time: an editor session leaks at least 1 MB per edit, for as long as the server runs.
18 InternPool.init() sites in src/ (and 14 AstPool.new()), most of them placeholders: Codegen.w:641,654,1108,1109, main.w:2572,3999,4273,4304, Parse.w:26, Lsp.w:741.
InternPool and AstPool become owned values (resource type, impl Drop freeing the pages, the maps and the state block) with one owner per compilation (Zcu/Compilation, the LSP document); everyone else borrows &InternPool / &AstPool (today they are passed by value as Copy handles to Parser, Sema, MirLower, Codegen, the analyze tools: hundreds of signatures).
Until then, no new InternPool.init() / AstPool.new() outside the one creation site per compilation; a placeholder reuses the live handles (the comptime_take_sema precedent).
A pin: a long-running with lsp session's RSS after N reparses of the same document is flat (or the debug allocator's leak report on a program that creates and drops an InternPool).
Related: D111/D120 (a Copy type must not own memory without a count), #1944.
Activity
InternPool and AstPool are counted handles: a clone is another holder…
docs: the 2026-10-18 handoff (#2449 pools, D22/D44 compliant, D120 Am…
Wave 4: []mut T stages 2-3 (#604), borrow &InternPool/&AstPool across…