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
emit-c: map keys and values are never dropped (clear, remove and scope exit leak owning elements) #1192
The C backend emits with_hashmap_clear / with_hashmap_remove with no element drops and never frees a map's keys or values (src/CCodegen.w ~6407, ~6908; no with_hashmap_free, no slot walk). The LLVM backend walks live slots with the receiver's sema type before clear and at scope exit (mir_emit_hash_collection_element_drops), and since #1189 transports the stored key out of remove and drops it. With an owning key or value type (HashMap[str, str]) emit-c output leaks every element.
Found while fixing #1189; not changed there. Related: emit-c already fails loudly for values()/items() and for map traversal (D44).
Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced in source. The C backend's map.clear (src/CCodegen.w:7782-7789) emits with_hashmap_clear(...) with no walk of the live slots, and no with_hashmap_free or element drop appears anywhere in src/CCodegen.w.
post-release: part of the emit-C lane campaign (#955).
Activity
HashMap.remove and HashSet.remove release the stored key (#1194)
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced in source. The C backend'smap.clear(src/CCodegen.w:7782-7789) emitswith_hashmap_clear(...)with no walk of the live slots, and nowith_hashmap_freeor element drop appears anywhere insrc/CCodegen.w.post-release: part of the emit-C lane campaign (#955).
The C backend drops a map's elements: a fixture for clear and scope e…