Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler memory leaks #22984

Open
andrewrk opened this issue Feb 23, 2025 · 0 comments
Open

compiler memory leaks #22984

andrewrk opened this issue Feb 23, 2025 · 0 comments
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone

Comments

@andrewrk
Copy link
Member

Zig Version

0.14.0-dev.3348+cc00abade

Steps to Reproduce and Observed Behavior

$ stage3/bin/zig build -p stage4 -Dno-lib
$ stage4/bin/zig build -p stage5 -Dno-lib -Denable-llvm
error: error(gpa): memory address 0x7f45ab060000 leaked: 
/home/andy/dev/zig/lib/std/array_list.zig:707:58: 0x1c11ef6 in toOwnedSlice (zig)
            const new_memory = try allocator.alignedAlloc(T, alignment, self.items.len);
                                                         ^
/home/andy/dev/zig/src/Zcu/PerThread.zig:2772:49: 0x26c6f29 in analyzeFnBodyInner (zig)
        .extra = try sema.air_extra.toOwnedSlice(gpa),
                                                ^
/home/andy/dev/zig/src/Zcu/PerThread.zig:1619:40: 0x2382178 in analyzeFuncBody (zig)
    var air = try pt.analyzeFnBodyInner(func_index);
                                       ^
/home/andy/dev/zig/src/Zcu/PerThread.zig:1539:66: 0x1ff7bc0 in ensureFuncBodyUpToDate (zig)
    const ies_outdated, const new_failed = if (pt.analyzeFuncBody(func_index)) |result|
                                                                 ^

error(gpa): memory address 0x7f45aa880080 leaked: 
/home/andy/dev/zig/lib/std/array_list.zig:1094:62: 0x1e3bd28 in ensureTotalCapacityPrecise (zig)
                const new_memory = try allocator.alignedAlloc(T, alignment, new_capacity);
                                                             ^
/home/andy/dev/zig/lib/std/array_list.zig:1070:51: 0x1cf8d7c in ensureTotalCapacity (zig)
            return self.ensureTotalCapacityPrecise(gpa, growCapacity(self.capacity, new_capacity));
                                                  ^
/home/andy/dev/zig/src/Zcu/PerThread.zig:2611:43: 0x26c5037 in analyzeFnBodyInner (zig)
    try sema.air_extra.ensureTotalCapacity(gpa, reserved_count);
                                          ^
/home/andy/dev/zig/src/Zcu/PerThread.zig:1619:40: 0x2382178 in analyzeFuncBody (zig)
    var air = try pt.analyzeFnBodyInner(func_index);
                                       ^
error(gpa): memory address 0x7f4671fa5000 leaked: 
/home/andy/dev/zig/lib/std/multi_array_list.zig:442:51: 0x2bcc9a4 in setCapacity (zig)
            const new_bytes = try gpa.alignedAlloc(
                                                  ^
/home/andy/dev/zig/lib/std/multi_array_list.zig:411:36: 0x2731e6c in ensureTotalCapacity (zig)
            return self.setCapacity(gpa, growCapacity(self.capacity, new_capacity));
                                   ^
/home/andy/dev/zig/lib/std/multi_array_list.zig:434:44: 0x2731de0 in ensureUnusedCapacity (zig)
            return self.ensureTotalCapacity(gpa, self.len + additional_count);
                                           ^
/home/andy/dev/zig/src/Sema.zig:781:55: 0x2bcfd18 in addInstAsIndex (zig)
        try sema.air_instructions.ensureUnusedCapacity(gpa, 1);
                                                      ^

Expected Behavior

no memory leaks

@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. labels Feb 23, 2025
@andrewrk andrewrk added this to the 0.15.0 milestone Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

No branches or pull requests

1 participant