Archived
1
2
Fork
You've already forked zig-mimalloc
0
Zig bindings for mimalloc.
This repository has been archived on 2024年06月28日. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • C 48.4%
  • HTML 39%
  • JavaScript 5.7%
  • CSS 2.7%
  • C++ 2%
  • Other 2.2%
2023年11月02日 13:43:02 +08:00
.github feat: initial commit 2023年10月27日 15:52:03 +08:00
c_src/mimalloc Merge commit ' 6da4fd492f ' as 'c_src/mimalloc' 2023年10月30日 21:31:12 +08:00
examples refactor: wrap the heap api 2023年10月31日 14:00:48 +08:00
src feat: support backing and default 2023年11月02日 13:43:02 +08:00
.gitignore Squashed 'c_src/mimalloc/' content from commit 43ce4bd 2023年10月30日 21:31:12 +08:00
build.zig refactor: wrap the heap api 2023年10月31日 14:00:48 +08:00
LICENSE Squashed 'c_src/mimalloc/' content from commit 43ce4bd 2023年10月30日 21:31:12 +08:00
README.md feat: export raw API 2023年10月30日 12:25:16 +08:00

zig-mimalloc

GitHub Workflow Status Codecov

Zig bindings for mimalloc.

Installing

Add zig-mimalloc to build.zig.zon:

.{.name="hello",.version="0.1.0",.dependencies=.{.mimalloc=.{.url="https://github.com/maolonglong/zig-mimalloc/archive/<commit SHA>.tar.gz",.hash="...",},},}

Then, edit build.zig:

constmimalloc=b.dependency("mimalloc",.{.target=target,.optimize=optimize,});exe.linkLibrary(mimalloc.artifact("mimalloc"));exe.addModule("mimalloc",mimalloc.module("mimalloc"));

Usage

conststd=@import("std");constmimalloc=@import("mimalloc");pubfnmain()!void{vara=std.ArrayList(usize).init(mimalloc.default_allocator);defera.deinit();for(0..100)|i|{trya.append(i);}std.debug.print("len: {}\n",.{a.items.len});}