Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 698 Bytes

File metadata and controls

28 lines (19 loc) · 698 Bytes

mimalloc-zig-wrapper

A lightweight implementation of Zig's std.mem.Allocator interface that wraps around Microsoft's mimalloc.

Works with Zig 0.15.2.

Usage

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);
}

Build

You might have to go into build.zig and fix up the paths to point to the right libraries.

zig build

Test

zig build test