mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-09 15:19:07 +00:00
debug: fix MemoryAccessor file leak
- patch authored by Jacob Young - tested on alpine-aarch64, 3.21.0, qemu-system 9.2.0 - issue manifested on Alpine Linux aarch64 under qemu-system where zig2 fails during bootstrap: error.ProcessFdQuotaExceeded
This commit is contained in:
parent
4de2b1ea65
commit
c44be99f1a
2 changed files with 12 additions and 0 deletions
|
|
@ -775,6 +775,7 @@ pub const StackIterator = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(it: *StackIterator) void {
|
pub fn deinit(it: *StackIterator) void {
|
||||||
|
it.ma.deinit();
|
||||||
if (have_ucontext and it.unwind_state != null) it.unwind_state.?.dwarf_context.deinit();
|
if (have_ucontext and it.unwind_state != null) it.unwind_state.?.dwarf_context.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,17 @@ pub const init: MemoryAccessor = .{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub fn deinit(ma: *MemoryAccessor) void {
|
||||||
|
switch (native_os) {
|
||||||
|
.linux => switch (ma.mem.handle) {
|
||||||
|
-2, -1 => {},
|
||||||
|
else => ma.mem.close(),
|
||||||
|
},
|
||||||
|
else => {},
|
||||||
|
}
|
||||||
|
ma.* = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
fn read(ma: *MemoryAccessor, address: usize, buf: []u8) bool {
|
fn read(ma: *MemoryAccessor, address: usize, buf: []u8) bool {
|
||||||
switch (native_os) {
|
switch (native_os) {
|
||||||
.linux => while (true) switch (ma.mem.handle) {
|
.linux => while (true) switch (ma.mem.handle) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue