From 242627199ba7c0372122be6e4672d1d56a13963e Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:12:29 -0300 Subject: [PATCH] chore: properly deallocate OAM buffer --- src/ppu.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ppu.zig b/src/ppu.zig index 7b9152b..d8766da 100644 --- a/src/ppu.zig +++ b/src/ppu.zig @@ -71,6 +71,7 @@ pub const Ppu = struct { self.alloc.free(self.framebuf); self.vram.deinit(); self.palette.deinit(); + self.oam.deinit(); } pub fn setBgOffsets(self: *Self, comptime n: u3, word: u32) void { @@ -517,6 +518,10 @@ const Oam = struct { }; } + fn deinit(self: Self) void { + self.alloc.free(self.buf); + } + pub fn get32(self: *const Self, idx: usize) u32 { return (@as(u32, self.buf[idx + 3]) << 24) | (@as(u32, self.buf[idx + 2]) << 16) | (@as(u32, self.buf[idx + 1]) << 8) | (@as(u32, self.buf[idx])); }