massivelivefun/mimalloc-zig-wrapper
A lightweight implementation of Zig's std.mem.Allocator interface that wraps around Microsoft's mimalloc.
refsA lightweight implementation of Zig's std.mem.Allocator interface that wraps around Microsoft's mimalloc.
Works with Zig 0.15.2.
Use this library as a Zig library (instructions here) and then add something like this to your root source file:
const mimalloc = @import("mimalloc-zig-wrapper");
const mi = mimalloc.mimalloc_allocator;
pub fn main() !void {
const memory = try mi.alloc(i32, 1);
memory[0] = 12;
mi.free(memory);
}
You might have to go into build.zig and fix up the paths to point to the right libraries.
zig build
zig build test