Zalloc, replace malloc and friends with a zig allocator in your c code

Not stupid!

This is so crazy, it just might work.

pub fn infect(mod: *std.Build.Module) void {
    mod.addCMacro("malloc", "zmalloc");
    mod.addCMacro("realloc", "zrealloc");
    mod.addCMacro("calloc", "zcalloc");
    mod.addCMacro("free", "zfree");
}
5 Likes