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
POD Vec[i32] buffer never freed at scope exit (debug-allocator finding) #608
POD Vec[i32] buffer is never freed (debug-allocator finding, out of scope for #606)
The native debug allocator (with run --debug-alloc, see docs/debug-allocator.md) reports a leak for a POD-element Vec whose buffer is never freed at scope exit:
fn main:
let ns: Vec[i32] = Vec.new()
ns.push(1)
ns.push(2)
print_i32(ns.len() as i32)
$ with run --debug-alloc pod.w
2
debug-alloc: LEAK addr=… size=…
debug-alloc: leak count=1
This is distinct from #606 (inline-drop struct fields). It is the narrow drop gate's deliberate behavior: only Drop-element Vecs get with_vec_free at scope exit; POD-element Vecs (Vec[i32], Vec[str], …) are treated as cheap copyable handles and their buffers are not freed (freeing them was the abandoned "wide flip" — src/CodegenDispatch.wmir_emit_drop_vec_ptr returns false for POD-element Vecs). The buffer is reclaimed by the OS at process exit, so it is a true heap leak in long-running code, not a use-after-free or double-free.
Captured here so the debug allocator's view of it is pinned (fixture test/debug_alloc/da_pod_vec.w, //! expect-debug-alloc: leak count=1). Not chased — surfaced for prioritization.
Closing as by-design (provisional ruling, reversible): POD-element Vec buffers are deliberately NOT freed at scope exit under the narrow drop gate — Vec[T] needs drop iff type_needs_drop(T) (#606/#608 split; docs/debug-allocator.md documents it and test/debug_alloc/da_pod_vec.w PINS the leak-count=1 view so the instrument's expectation is explicit). The 'wide flip' (all Vecs own their buffers) is a separate deliberate project per the A5 handoff record — the compiler pervasively copies POD Vec headers as cheap handles, so the flip is a coordinated migration, not a bug fix. Refile as that project when it's actually scheduled.
Activity
ehartford commentedon Jul 2, 2026
Closing as by-design (provisional ruling, reversible): POD-element Vec buffers are deliberately NOT freed at scope exit under the narrow drop gate —
Vec[T]needs drop ifftype_needs_drop(T)(#606/#608 split; docs/debug-allocator.md documents it and test/debug_alloc/da_pod_vec.w PINS the leak-count=1 view so the instrument's expectation is explicit). The 'wide flip' (all Vecs own their buffers) is a separate deliberate project per the A5 handoff record — the compiler pervasively copies POD Vec headers as cheap handles, so the flip is a coordinated migration, not a bug fix. Refile as that project when it's actually scheduled.Fix #641: std allocator destructors actually run (impl Drop conversions)
Docs: handoff — #689 resolved as duplicate of #608 by-design ruling; …
Sema: mut self binds mutable for every owner type (D12 uniformity); d…
Sema: mut fn on str owners lowers via share-place over the fat pointe…
Tools: drop-audit matrix as a repo-committed With tool + :drop-audit …
CLI: default build memory ceiling 32 -> 64 GiB (#702)
Debug-alloc lane: retire the two #608 leak-by-design pins (#691 flip …
build: pin migrate-compiler-c memory cap off until the str flip; reco…