mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 03:48:56 +00:00
We can't use `std.heap.c_allocator` as `z_allocator`; it doesn't zero-initialize the memory. This PR adds a fallback implementation. This PR also makes Bun compile successfully with `use_mimalloc` set to false. More work is likely necessary to make it function correctly in this case, but it should at least compile. (For internal tracking: fixes STAB-978, STAB-979)
10 lines
272 B
Zig
10 lines
272 B
Zig
pub const c_allocator = std.heap.c_allocator;
|
|
pub const z_allocator = @import("./fallback/z.zig").allocator;
|
|
|
|
/// libc can free allocations without being given their size.
|
|
pub fn freeWithoutSize(ptr: ?*anyopaque) void {
|
|
std.c.free(ptr);
|
|
}
|
|
|
|
const std = @import("std");
|