mirror of
https://codeberg.org/ziglang/zig
synced 2026-11-18 07:05:05 +00:00
rework memory management of Module.Namespace hash maps
The motivating problem here was a memory leak in the hash maps of Module.Namespace. The commit deletes more of the legacy incremental compilation implementation. It had things like use of orderedRemove and trying to do too much OOP-style creation and deletion of objects. Instead, this commit iterates over all the namespaces on Module deinit and calls deinit on the hash map fields. This logic is much simpler to reason about. Similarly, change global inline assembly to an array hash map since iterating over the values is a primary use of it, and clean up the remaining values on Module deinit, solving another memory leak. After this there are no more memory leaks remaining when using the x86 backend in a libc-less compiler.
This commit is contained in:
parent
53500a5768
commit
91b897ef58
5 changed files with 25 additions and 194 deletions
180
src/Module.zig
180
src/Module.zig
Loading…
Add table
Add a link
Reference in a new issue