cons buffer: []u8 = std.Io.Dir.readFileAllocOptions(...) // with align 4
gpa.free(buffer); 

gives an error

thread 17498 panic: free of [addr: 776193d598a0, len: 1408 (0x580) align: 1] mismatches allocation of [addr: 776193d598a0, len: 1408 (0x580) align: 4]

I know about .rawFree which has an alignment as the second param but I can’t pass the third param which is not returned to me in the first place… (Not to mention this one is marked as usable only for internal implementation of allocator)

vulpesx July 16, 2026, 1:44pm 2

Change the type of your variable to []align(4) u8, or ommit the type.

You’re just loosing type information due to a safe coercion, but the (debug) allocator doesn’t know that.