Skip to content

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

License

Notifications You must be signed in to change notification settings

massivelivefun/mimalloc-zig-wrapper

Repository files navigation

mimalloc-zig-wrapper

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

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

About

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

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages